Skip to content

Commit 557be9f

Browse files
Merge branch '2.4-develop' of github.com:magento-commerce/magento2ce into ACPT-488-ACPT-489-ACPT-490
2 parents 5b1c168 + bcb0fea commit 557be9f

File tree

127 files changed

+1496
-1258
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+1496
-1258
lines changed

app/code/Magento/AdminAdobeIms/Api/Data/ImsWebapiInterface.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
76
declare(strict_types=1);
87

98
namespace Magento\AdminAdobeIms\Api\Data;

app/code/Magento/AdminAdobeIms/Api/Data/ImsWebapiSearchResultsInterface.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
76
declare(strict_types=1);
87

98
namespace Magento\AdminAdobeIms\Api\Data;

app/code/Magento/AdminAdobeIms/Api/ImsLogOutInterface.php

Lines changed: 0 additions & 25 deletions
This file was deleted.

app/code/Magento/AdminAdobeIms/Api/ImsWebapiRepositoryInterface.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
76
declare(strict_types=1);
87

98
namespace Magento\AdminAdobeIms\Api;

app/code/Magento/AdminAdobeIms/App/Action/Plugin/Authentication.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
76
declare(strict_types=1);
87

98
namespace Magento\AdminAdobeIms\App\Action\Plugin;

app/code/Magento/AdminAdobeIms/Block/Adminhtml/System/Config/Form/Field/Disabled.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
76
declare(strict_types=1);
87

98
namespace Magento\AdminAdobeIms\Block\Adminhtml\System\Config\Form\Field;

app/code/Magento/AdminAdobeIms/Console/Command/AdminAdobeImsDisableCommand.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
76
declare(strict_types=1);
87

98
namespace Magento\AdminAdobeIms\Console\Command;

app/code/Magento/AdminAdobeIms/Console/Command/AdminAdobeImsEnableCommand.php

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
76
declare(strict_types=1);
87

98
namespace Magento\AdminAdobeIms\Console\Command;
109

11-
use Magento\AdminAdobeIms\Model\ImsConnection;
12-
use Magento\AdminAdobeIms\Service\UpdateTokensService;
1310
use Magento\AdminAdobeIms\Service\ImsCommandOptionService;
1411
use Magento\AdminAdobeIms\Service\ImsConfig;
12+
use Magento\AdminAdobeIms\Service\UpdateTokensService;
13+
use Magento\AdobeImsApi\Api\AuthorizationInterface;
1514
use Magento\Framework\App\Cache\Type\Config;
1615
use Magento\Framework\App\Cache\TypeListInterface;
1716
use Magento\Framework\Console\Cli;
@@ -53,11 +52,6 @@ class AdminAdobeImsEnableCommand extends Command
5352
*/
5453
private ImsConfig $adminImsConfig;
5554

56-
/**
57-
* @var ImsConnection
58-
*/
59-
private ImsConnection $adminImsConnection;
60-
6155
/**
6256
* @var ImsCommandOptionService
6357
*/
@@ -73,26 +67,31 @@ class AdminAdobeImsEnableCommand extends Command
7367
*/
7468
private UpdateTokensService $updateTokensService;
7569

70+
/**
71+
* @var AuthorizationInterface
72+
*/
73+
private AuthorizationInterface $authorization;
74+
7675
/**
7776
* @param ImsConfig $adminImsConfig
78-
* @param ImsConnection $adminImsConnection
7977
* @param ImsCommandOptionService $imsCommandOptionService
8078
* @param TypeListInterface $cacheTypeList
8179
* @param UpdateTokensService $updateTokensService
80+
* @param AuthorizationInterface $authorization
8281
*/
8382
public function __construct(
8483
ImsConfig $adminImsConfig,
85-
ImsConnection $adminImsConnection,
8684
ImsCommandOptionService $imsCommandOptionService,
8785
TypeListInterface $cacheTypeList,
88-
UpdateTokensService $updateTokensService
86+
UpdateTokensService $updateTokensService,
87+
AuthorizationInterface $authorization
8988
) {
9089
parent::__construct();
9190
$this->adminImsConfig = $adminImsConfig;
92-
$this->adminImsConnection = $adminImsConnection;
9391
$this->imsCommandOptionService = $imsCommandOptionService;
9492
$this->cacheTypeList = $cacheTypeList;
9593
$this->updateTokensService = $updateTokensService;
94+
$this->authorization = $authorization;
9695

9796
$this->setName('admin:adobe-ims:enable')
9897
->setDescription('Enable Adobe IMS Module.')
@@ -199,7 +198,7 @@ private function enableModule(
199198
string $organizationId,
200199
bool $isTwoFactorAuthEnabled
201200
): bool {
202-
$testAuth = $this->adminImsConnection->testAuth($clientId);
201+
$testAuth = $this->authorization->testAuth($clientId);
203202
if ($testAuth) {
204203
$this->adminImsConfig->enableModule($clientId, $clientSecret, $organizationId, $isTwoFactorAuthEnabled);
205204
$this->cacheTypeList->cleanType(Config::TYPE_IDENTIFIER);

app/code/Magento/AdminAdobeIms/Console/Command/AdminAdobeImsInfoCommand.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
76
declare(strict_types=1);
87

98
namespace Magento\AdminAdobeIms\Console\Command;
109

11-
use Magento\AdminAdobeIms\Model\ImsConnection;
1210
use Magento\AdminAdobeIms\Service\ImsConfig;
11+
use Magento\AdobeImsApi\Api\AuthorizationInterface;
1312
use Magento\Framework\Console\Cli;
1413
use Symfony\Component\Console\Command\Command;
1514
use Symfony\Component\Console\Input\InputInterface;
@@ -41,21 +40,21 @@ class AdminAdobeImsInfoCommand extends Command
4140
private ImsConfig $adminImsConfig;
4241

4342
/**
44-
* @var ImsConnection
43+
* @var AuthorizationInterface
4544
*/
46-
private ImsConnection $adminImsConnection;
45+
private AuthorizationInterface $authorization;
4746

4847
/**
4948
* @param ImsConfig $adminImsConfig
50-
* @param ImsConnection $adminImsConnection
49+
* @param AuthorizationInterface $authorization
5150
*/
5251
public function __construct(
5352
ImsConfig $adminImsConfig,
54-
ImsConnection $adminImsConnection
53+
AuthorizationInterface $authorization
5554
) {
5655
parent::__construct();
5756
$this->adminImsConfig = $adminImsConfig;
58-
$this->adminImsConnection = $adminImsConnection;
57+
$this->authorization = $authorization;
5958

6059
$this->setName('admin:adobe-ims:info')
6160
->setDescription('Information of Adobe IMS Module configuration');
@@ -69,7 +68,7 @@ protected function execute(InputInterface $input, OutputInterface $output): ?int
6968
try {
7069
if ($this->adminImsConfig->enabled()) {
7170
$clientId = $this->adminImsConfig->getApiKey();
72-
if ($this->adminImsConnection->testAuth($clientId)) {
71+
if ($this->authorization->testAuth($clientId)) {
7372
$clientSecret = $this->adminImsConfig->getPrivateKey() ? 'configured' : 'not configured';
7473
$output->writeln(self::CLIENT_ID_NAME . ': ' . $clientId);
7574
$output->writeln(self::ORGANIZATION_ID_NAME . ': ' . $this->adminImsConfig->getOrganizationId());

app/code/Magento/AdminAdobeIms/Console/Command/AdminAdobeImsStatusCommand.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
76
declare(strict_types=1);
87

98
namespace Magento\AdminAdobeIms\Console\Command;

app/code/Magento/AdminAdobeIms/Controller/Adminhtml/OAuth/ImsCallback.php

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
76
declare(strict_types=1);
87

98
namespace Magento\AdminAdobeIms\Controller\Adminhtml\OAuth;
109

1110
use Exception;
12-
use Magento\AdminAdobeIms\Exception\AdobeImsOrganizationAuthorizationException;
1311
use Magento\AdminAdobeIms\Exception\AdobeImsAuthorizationException;
1412
use Magento\AdminAdobeIms\Logger\AdminAdobeImsLogger;
1513
use Magento\AdminAdobeIms\Service\AdminLoginProcessService;
1614
use Magento\AdminAdobeIms\Service\ImsConfig;
17-
use Magento\AdminAdobeIms\Service\ImsOrganizationService;
15+
use Magento\AdobeIms\Exception\AdobeImsOrganizationAuthorizationException;
16+
use Magento\AdobeImsApi\Api\GetProfileInterface;
17+
use Magento\AdobeImsApi\Api\GetTokenInterface;
18+
use Magento\AdobeImsApi\Api\OrganizationMembershipInterface;
1819
use Magento\Backend\App\Action\Context;
19-
use Magento\AdminAdobeIms\Model\ImsConnection;
2020
use Magento\Backend\Controller\Adminhtml\Auth;
2121
use Magento\Backend\Model\View\Result\Redirect;
2222
use Magento\Framework\App\Action\HttpGetActionInterface;
@@ -26,20 +26,15 @@ class ImsCallback extends Auth implements HttpGetActionInterface
2626
{
2727
public const ACTION_NAME = 'imscallback';
2828

29-
/**
30-
* @var ImsConnection
31-
*/
32-
private ImsConnection $adminImsConnection;
33-
3429
/**
3530
* @var ImsConfig
3631
*/
3732
private ImsConfig $adminImsConfig;
3833

3934
/**
40-
* @var ImsOrganizationService
35+
* @var OrganizationMembershipInterface
4136
*/
42-
private ImsOrganizationService $adminOrganizationService;
37+
private OrganizationMembershipInterface $organizationMembership;
4338

4439
/**
4540
* @var AdminLoginProcessService
@@ -51,28 +46,41 @@ class ImsCallback extends Auth implements HttpGetActionInterface
5146
*/
5247
private AdminAdobeImsLogger $logger;
5348

49+
/**
50+
* @var GetTokenInterface
51+
*/
52+
private GetTokenInterface $token;
53+
54+
/**
55+
* @var GetProfileInterface
56+
*/
57+
private GetProfileInterface $profile;
58+
5459
/**
5560
* @param Context $context
56-
* @param ImsConnection $adminImsConnection
5761
* @param ImsConfig $adminImsConfig
58-
* @param ImsOrganizationService $adminOrganizationService
62+
* @param OrganizationMembershipInterface $organizationMembership
5963
* @param AdminLoginProcessService $adminLoginProcessService
6064
* @param AdminAdobeImsLogger $logger
65+
* @param GetTokenInterface $token
66+
* @param GetProfileInterface $profile
6167
*/
6268
public function __construct(
6369
Context $context,
64-
ImsConnection $adminImsConnection,
6570
ImsConfig $adminImsConfig,
66-
ImsOrganizationService $adminOrganizationService,
71+
OrganizationMembershipInterface $organizationMembership,
6772
AdminLoginProcessService $adminLoginProcessService,
68-
AdminAdobeImsLogger $logger
73+
AdminAdobeImsLogger $logger,
74+
GetTokenInterface $token,
75+
GetProfileInterface $profile
6976
) {
7077
parent::__construct($context);
71-
$this->adminImsConnection = $adminImsConnection;
7278
$this->adminImsConfig = $adminImsConfig;
73-
$this->adminOrganizationService = $adminOrganizationService;
79+
$this->organizationMembership = $organizationMembership;
7480
$this->adminLoginProcessService = $adminLoginProcessService;
7581
$this->logger = $logger;
82+
$this->token = $token;
83+
$this->profile = $profile;
7684
}
7785

7886
/**
@@ -99,17 +107,17 @@ public function execute(): Redirect
99107
}
100108

101109
//get token from response
102-
$tokenResponse = $this->adminImsConnection->getTokenResponse($code);
110+
$tokenResponse = $this->token->getTokenResponse($code);
103111
$accessToken = $tokenResponse->getAccessToken();
104112

105113
//get profile info to check email
106-
$profile = $this->adminImsConnection->getProfile($accessToken);
114+
$profile = $this->profile->getProfile($accessToken);
107115
if (empty($profile['email'])) {
108116
throw new AuthenticationException(__('An authentication error occurred. Verify and try again.'));
109117
}
110118

111119
//check membership in organization
112-
$this->adminOrganizationService->checkOrganizationMembership($accessToken);
120+
$this->organizationMembership->checkOrganizationMembership($accessToken);
113121

114122
$this->adminLoginProcessService->execute($tokenResponse, $profile);
115123
} catch (AdobeImsAuthorizationException $e) {

0 commit comments

Comments
 (0)