Skip to content

Commit d74bbf7

Browse files
authored
Merge pull request #7612 from magento-performance/ims-phase1
CABPI-4: IMS identity | Adobe Commerce Core Admin Panel
2 parents 9661597 + af9598e commit d74bbf7

File tree

172 files changed

+12856
-28
lines changed

Some content is hidden

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

172 files changed

+12856
-28
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
view/adminhtml/web/node_modules/
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\AdminAdobeIms\Api\Data;
10+
11+
use Magento\Framework\Api\ExtensibleDataInterface;
12+
13+
/**
14+
* Declare the ims token data service object
15+
* @api
16+
*/
17+
interface ImsWebapiInterface extends ExtensibleDataInterface
18+
{
19+
/**
20+
* Get ID
21+
*
22+
* @return int|null
23+
*/
24+
public function getId();
25+
26+
/**
27+
* Get admin user ID
28+
*
29+
* @return int|null
30+
*/
31+
public function getAdminUserId(): ?int;
32+
33+
/**
34+
* Set admin user ID
35+
*
36+
* @param int $value
37+
* @return $this
38+
*/
39+
public function setAdminUserId(int $value): ImsWebapiInterface;
40+
41+
/**
42+
* Get access token hash
43+
*
44+
* @return string|null
45+
*/
46+
public function getAccessTokenHash(): ?string;
47+
48+
/**
49+
* Set access token hash
50+
*
51+
* @param string $value
52+
* @return $this
53+
*/
54+
public function setAccessTokenHash(string $value): ImsWebapiInterface;
55+
56+
/**
57+
* Get access token
58+
*
59+
* @return string|null
60+
*/
61+
public function getAccessToken(): ?string;
62+
63+
/**
64+
* Set access token
65+
*
66+
* @param string $value
67+
* @return $this
68+
*/
69+
public function setAccessToken(string $value): ImsWebapiInterface;
70+
71+
/**
72+
* Get creation time
73+
*
74+
* @return string|null
75+
*/
76+
public function getCreatedAt(): ?string;
77+
78+
/**
79+
* Set creation time
80+
*
81+
* @param string $value
82+
* @return $this
83+
*/
84+
public function setCreatedAt(string $value): ImsWebapiInterface;
85+
86+
/**
87+
* Get update time
88+
*
89+
* @return string|null
90+
*/
91+
public function getUpdatedAt(): ?string;
92+
93+
/**
94+
* Set update time
95+
*
96+
* @param string $value
97+
* @return $this
98+
*/
99+
public function setUpdatedAt(string $value): ImsWebapiInterface;
100+
101+
/**
102+
* Get last check time
103+
*
104+
* @return string|null
105+
*/
106+
public function getLastCheckTime(): ?string;
107+
108+
/**
109+
* Set last check time
110+
*
111+
* @param string $value
112+
* @return $this
113+
*/
114+
public function setLastCheckTime(string $value): ImsWebapiInterface;
115+
116+
/**
117+
* Get expires time of token
118+
*
119+
* @return string|null
120+
*/
121+
public function getAccessTokenExpiresAt(): ?string;
122+
123+
/**
124+
* Set expires time of token
125+
*
126+
* @param string $value
127+
* @return $this
128+
*/
129+
public function setAccessTokenExpiresAt(string $value): ImsWebapiInterface;
130+
131+
/**
132+
* Retrieve existing extension attributes object or create a new one.
133+
*
134+
* @return \Magento\AdminAdobeIms\Api\Data\ImsWebapiExtensionInterface|null
135+
*/
136+
public function getExtensionAttributes(): ImsWebapiExtensionInterface;
137+
138+
/**
139+
* Set extension attributes
140+
*
141+
* @param \Magento\AdminAdobeIms\Api\Data\ImsWebapiExtensionInterface $extensionAttributes
142+
* @return $this
143+
*/
144+
public function setExtensionAttributes(ImsWebapiExtensionInterface $extensionAttributes): ImsWebapiInterface;
145+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\AdminAdobeIms\Api\Data;
10+
11+
use Magento\AdminAdobeIms\Api\Data\ImsWebapiInterface;
12+
use Magento\Framework\Api\SearchResultsInterface;
13+
14+
/**
15+
* Interface ImsWebapiSearchResultsInterface
16+
*
17+
* @api
18+
*/
19+
interface ImsWebapiSearchResultsInterface extends SearchResultsInterface
20+
{
21+
/**
22+
* Get ims token list.
23+
*
24+
* @return ImsWebapiInterface[]
25+
*/
26+
public function getItems();
27+
28+
/**
29+
* Set ims token list.
30+
*
31+
* @param ImsWebapiInterface[] $items
32+
* @return $this
33+
*/
34+
public function setItems(array $items);
35+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\AdminAdobeIms\Api;
10+
11+
/**
12+
* Declare functionality for user logout from the Adobe IMS account
13+
*
14+
* @api
15+
*/
16+
interface ImsLogOutInterface
17+
{
18+
/**
19+
* LogOut User from Adobe IMS Account
20+
*
21+
* @param string|null $accessToken
22+
* @return bool
23+
*/
24+
public function execute(?string $accessToken = null) : bool;
25+
}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\AdminAdobeIms\Api;
10+
11+
use Magento\AdminAdobeIms\Api\Data\ImsWebapiInterface;
12+
13+
use Magento\AdminAdobeIms\Api\Data\ImsWebapiSearchResultsInterface;
14+
use Magento\Framework\Api\SearchCriteriaInterface;
15+
use Magento\Framework\Exception\CouldNotSaveException;
16+
use Magento\Framework\Exception\LocalizedException;
17+
use Magento\Framework\Exception\NoSuchEntityException;
18+
19+
/**
20+
* Declare ims web api repository
21+
* @api
22+
*/
23+
interface ImsWebapiRepositoryInterface
24+
{
25+
/**
26+
* Save ims token
27+
*
28+
* @param ImsWebapiInterface $entity
29+
* @return void
30+
* @throws CouldNotSaveException
31+
*/
32+
public function save(ImsWebapiInterface $entity): void;
33+
34+
/**
35+
* Get ims token
36+
*
37+
* @param int $entityId
38+
* @return ImsWebapiInterface
39+
* @throws NoSuchEntityException
40+
*/
41+
public function get(int $entityId): ImsWebapiInterface;
42+
43+
/**
44+
* Get ims token(s) by admin user id
45+
*
46+
* @param int $adminUserId
47+
* @return ImsWebapiInterface[]
48+
* @throws NoSuchEntityException
49+
*/
50+
public function getByAdminUserId(int $adminUserId): array;
51+
52+
/**
53+
* Get entity by access token hash
54+
*
55+
* @param string $tokenHash
56+
* @return ImsWebapiInterface
57+
* @throws NoSuchEntityException
58+
*/
59+
public function getByAccessTokenHash(string $tokenHash): ImsWebapiInterface;
60+
61+
/**
62+
* Get ims token by search criteria
63+
*
64+
* @param SearchCriteriaInterface $searchCriteria
65+
* @return ImsWebapiSearchResultsInterface
66+
* @throws NoSuchEntityException
67+
*/
68+
public function getList(SearchCriteriaInterface $searchCriteria): ImsWebapiSearchResultsInterface;
69+
70+
/**
71+
* Delete ims tokens for admin user id.
72+
*
73+
* @param int $adminUserId
74+
* @return bool
75+
* @throws NoSuchEntityException
76+
* @throws LocalizedException
77+
*/
78+
public function deleteByAdminUserId(int $adminUserId): bool;
79+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\AdminAdobeIms\Api;
10+
11+
use Magento\Framework\Exception\AuthenticationException;
12+
use Magento\Framework\Exception\AuthorizationException;
13+
use Magento\Framework\Exception\InvalidArgumentException;
14+
15+
/**
16+
* Reads token data.
17+
*/
18+
interface TokenReaderInterface
19+
{
20+
/**
21+
* Read data from a token.
22+
*
23+
* @param string $token
24+
* @return array
25+
* @throws AuthenticationException
26+
* @throws AuthorizationException
27+
* @throws InvalidArgumentException
28+
*/
29+
public function read(string $token);
30+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\AdminAdobeIms\App\Action\Plugin;
10+
11+
use Magento\AdminAdobeIms\Controller\Adminhtml\OAuth\ImsCallback;
12+
use Magento\Backend\App\Action\Plugin\Authentication as CoreAuthentication;
13+
use Magento\Backend\App\BackendAppList;
14+
use Magento\Backend\Model\Auth;
15+
use Magento\Backend\Model\UrlInterface;
16+
use Magento\Framework\App\ActionFlag;
17+
use Magento\Framework\App\ResponseInterface;
18+
use Magento\Framework\Controller\Result\RedirectFactory;
19+
use Magento\Framework\Data\Form\FormKey\Validator;
20+
use Magento\Framework\Message\ManagerInterface;
21+
22+
class Authentication extends CoreAuthentication
23+
{
24+
/**
25+
* @param Auth $auth
26+
* @param UrlInterface $url
27+
* @param ResponseInterface $response
28+
* @param ActionFlag $actionFlag
29+
* @param ManagerInterface $messageManager
30+
* @param UrlInterface $backendUrl
31+
* @param RedirectFactory $resultRedirectFactory
32+
* @param BackendAppList $backendAppList
33+
* @param Validator $formKeyValidator
34+
*/
35+
public function __construct(
36+
Auth $auth,
37+
UrlInterface $url,
38+
ResponseInterface $response,
39+
ActionFlag $actionFlag,
40+
ManagerInterface $messageManager,
41+
UrlInterface $backendUrl,
42+
RedirectFactory $resultRedirectFactory,
43+
BackendAppList $backendAppList,
44+
Validator $formKeyValidator
45+
) {
46+
parent::__construct(
47+
$auth,
48+
$url,
49+
$response,
50+
$actionFlag,
51+
$messageManager,
52+
$backendUrl,
53+
$resultRedirectFactory,
54+
$backendAppList,
55+
$formKeyValidator
56+
);
57+
58+
$this->_openActions[] = ImsCallback::ACTION_NAME;
59+
}
60+
}

0 commit comments

Comments
 (0)