diff --git a/app/code/Magento/AdobeIms/Block/Adminhtml/SignIn.php b/app/code/Magento/AdobeIms/Block/Adminhtml/SignIn.php
new file mode 100644
index 0000000000000..debc88b56c7ad
--- /dev/null
+++ b/app/code/Magento/AdobeIms/Block/Adminhtml/SignIn.php
@@ -0,0 +1,194 @@
+config = $config;
+ $this->userContext = $userContext;
+ $this->userAuthorized = $userAuthorized;
+ $this->userProfileRepository = $userProfileRepository;
+ $this->serializer = $json;
+ parent::__construct($context, $data);
+ }
+
+ /**
+ * Get configuration for UI component
+ *
+ * @return string
+ */
+ public function getComponentJsonConfig(): string
+ {
+ return $this->serializer->serialize(
+ array_replace_recursive(
+ $this->getDefaultComponentConfig(),
+ ...$this->getExtendedComponentConfig()
+ )
+ );
+ }
+
+ /**
+ * Get default UI component configuration
+ *
+ * @return array
+ */
+ private function getDefaultComponentConfig(): array
+ {
+ return [
+ 'component' => self::ADOBE_IMS_JS_SIGNIN,
+ 'template' => self::ADOBE_IMS_SIGNIN,
+ 'profileUrl' => $this->getUrl(self::ADOBE_IMS_USER_PROFILE),
+ 'logoutUrl' => $this->getUrl(self::ADOBE_IMS_USER_LOGOUT),
+ 'user' => $this->getUserData(),
+ 'loginConfig' => [
+ 'url' => $this->config->getAuthUrl(),
+ 'callbackParsingParams' => [
+ 'regexpPattern' => self::RESPONSE_REGEXP_PATTERN,
+ 'codeIndex' => self::RESPONSE_CODE_INDEX,
+ 'messageIndex' => self::RESPONSE_MESSAGE_INDEX,
+ 'successCode' => self::RESPONSE_SUCCESS_CODE,
+ 'errorCode' => self::RESPONSE_ERROR_CODE
+ ]
+ ]
+ ];
+ }
+
+ /**
+ * Get UI component configuration extension specified in layout configuration for block instance
+ *
+ * @return array
+ */
+ private function getExtendedComponentConfig(): array
+ {
+ $configProviders = $this->getData(self::DATA_ARGUMENT_KEY_CONFIG_PROVIDERS);
+ if (empty($configProviders)) {
+ return [];
+ }
+
+ $configExtensions = [];
+ foreach ($configProviders as $configProvider) {
+ if ($configProvider instanceof ConfigProviderInterface) {
+ $configExtensions[] = $configProvider->get();
+ }
+ }
+ return $configExtensions;
+ }
+
+ /**
+ * Get user profile information
+ *
+ * @return array
+ */
+ private function getUserData(): array
+ {
+ if (!$this->userAuthorized->execute()) {
+ return $this->getDefaultUserData();
+ }
+
+ try {
+ $userProfile = $this->userProfileRepository->getByUserId((int)$this->userContext->getUserId());
+ } catch (NoSuchEntityException $exception) {
+ return $this->getDefaultUserData();
+ }
+
+ return [
+ 'isAuthorized' => true,
+ 'name' => $userProfile->getName(),
+ 'email' => $userProfile->getEmail(),
+ 'image' => $userProfile->getImage(),
+ ];
+ }
+
+ /**
+ * Get default user data for not authenticated or missing user profile
+ *
+ * @return array
+ */
+ private function getDefaultUserData(): array
+ {
+ return [
+ 'isAuthorized' => false,
+ 'name' => '',
+ 'email' => '',
+ 'image' => '',
+ ];
+ }
+}
diff --git a/app/code/Magento/AdobeIms/Controller/Adminhtml/OAuth/Callback.php b/app/code/Magento/AdobeIms/Controller/Adminhtml/OAuth/Callback.php
new file mode 100644
index 0000000000000..55f86062685e8
--- /dev/null
+++ b/app/code/Magento/AdobeIms/Controller/Adminhtml/OAuth/Callback.php
@@ -0,0 +1,175 @@
+getToken = $getToken;
+ $this->login = $login;
+ $this->logger = $logger;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function execute(): ResultInterface
+ {
+ try {
+ $this->validateCallbackRequest();
+ $tokenResponse = $this->getToken->execute(
+ (string)$this->getRequest()->getParam(self::REQUEST_PARAM_CODE)
+ );
+ $this->login->execute((int) $this->getUser()->getId(), $tokenResponse);
+
+ $response = sprintf(
+ self::RESPONSE_TEMPLATE,
+ self::RESPONSE_SUCCESS_CODE,
+ __('Authorization was successful')
+ );
+ } catch (AuthorizationException $exception) {
+ $response = sprintf(
+ self::RESPONSE_TEMPLATE,
+ self::RESPONSE_ERROR_CODE,
+ __(
+ 'Login failed. Please check if the Secret Key is set correctly and try again.',
+ [
+ 'url' => $this->getUrl(
+ 'adminhtml/system_config/edit',
+ [
+ 'section' => 'system',
+ '_fragment' => 'system_adobe_stock_integration-link'
+ ]
+ )
+ ]
+ )
+ );
+ } catch (ConfigurationMismatchException | CouldNotSaveException $exception) {
+ $response = sprintf(
+ self::RESPONSE_TEMPLATE,
+ self::RESPONSE_ERROR_CODE,
+ $exception->getMessage()
+ );
+ } catch (\Exception $exception) {
+ $this->logger->critical($exception);
+ $response = sprintf(
+ self::RESPONSE_TEMPLATE,
+ self::RESPONSE_ERROR_CODE,
+ __('Something went wrong.')
+ );
+ }
+
+ /** @var Raw $resultRaw */
+ $resultRaw = $this->resultFactory->create(ResultFactory::TYPE_RAW);
+ $resultRaw->setContents($response);
+
+ return $resultRaw;
+ }
+
+ /**
+ * Validate callback request from the Adobe OAth service
+ *
+ * @throws ConfigurationMismatchException
+ */
+ private function validateCallbackRequest(): void
+ {
+ $error = $this->getRequest()->getParam(self::REQUEST_PARAM_ERROR);
+ if ($error) {
+ $message = __(
+ 'An error occurred during the callback request from the Adobe service: %error',
+ ['error' => $error]
+ );
+ throw new ConfigurationMismatchException($message);
+ }
+ }
+
+ /**
+ * Get Authorised User
+ *
+ * @return UserInterface
+ */
+ private function getUser(): UserInterface
+ {
+ if (!$this->_auth->getUser() instanceof UserInterface) {
+ throw new \RuntimeException('Auth user object must be an instance of UserInterface');
+ }
+
+ return $this->_auth->getUser();
+ }
+}
diff --git a/app/code/Magento/AdobeIms/Controller/Adminhtml/User/Logout.php b/app/code/Magento/AdobeIms/Controller/Adminhtml/User/Logout.php
new file mode 100644
index 0000000000000..26b448106aa2a
--- /dev/null
+++ b/app/code/Magento/AdobeIms/Controller/Adminhtml/User/Logout.php
@@ -0,0 +1,70 @@
+logout = $logOut;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function execute()
+ {
+ if ($this->logout->execute()) {
+ $responseCode = self::HTTP_INTERNAL_SUCCESS;
+ $response = [
+ 'success' => true,
+ ];
+ } else {
+ $responseCode = self::HTTP_INTERNAL_ERROR;
+ $response = [
+ 'success' => false,
+ ];
+ }
+ /** @var Json $resultJson */
+ $resultJson = $this->resultFactory->create(ResultFactory::TYPE_JSON);
+ $resultJson->setHttpResponseCode($responseCode);
+ $resultJson->setData($response);
+
+ return $resultJson;
+ }
+}
diff --git a/app/code/Magento/AdobeIms/Controller/Adminhtml/User/Profile.php b/app/code/Magento/AdobeIms/Controller/Adminhtml/User/Profile.php
new file mode 100644
index 0000000000000..35afea841c3e6
--- /dev/null
+++ b/app/code/Magento/AdobeIms/Controller/Adminhtml/User/Profile.php
@@ -0,0 +1,109 @@
+userContext = $userContext;
+ $this->userProfileRepository = $userProfileRepository;
+ $this->logger = $logger;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function execute()
+ {
+ try {
+ $userProfile = $this->userProfileRepository->getByUserId((int)$this->userContext->getUserId());
+ $userData = [
+ 'email' => $userProfile->getEmail(),
+ 'name' => $userProfile->getName(),
+ 'image' => $userProfile->getImage()
+ ];
+ $responseCode = self::HTTP_OK;
+
+ $responseContent = [
+ 'success' => true,
+ 'error_message' => '',
+ 'result' => $userData
+ ];
+
+ } catch (NoSuchEntityException $exception) {
+ $responseCode = self::HTTP_INTERNAL_ERROR;
+ $this->logger->critical($exception);
+ $responseContent = [
+ 'success' => false,
+ 'message' => __('An error occurred during get user data. Contact support.'),
+ ];
+ }
+
+ /** @var \Magento\Framework\Controller\Result\Json $resultJson */
+ $resultJson = $this->resultFactory->create(ResultFactory::TYPE_JSON);
+ $resultJson->setHttpResponseCode($responseCode);
+ $resultJson->setData($responseContent);
+
+ return $resultJson;
+ }
+}
diff --git a/app/code/Magento/AdobeIms/LICENSE.txt b/app/code/Magento/AdobeIms/LICENSE.txt
new file mode 100644
index 0000000000000..49525fd99da9c
--- /dev/null
+++ b/app/code/Magento/AdobeIms/LICENSE.txt
@@ -0,0 +1,48 @@
+
+Open Software License ("OSL") v. 3.0
+
+This Open Software License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work:
+
+Licensed under the Open Software License version 3.0
+
+ 1. Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following:
+
+ 1. to reproduce the Original Work in copies, either alone or as part of a collective work;
+
+ 2. to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work;
+
+ 3. to distribute or communicate copies of the Original Work and Derivative Works to the public, with the proviso that copies of Original Work or Derivative Works that You distribute or communicate shall be licensed under this Open Software License;
+
+ 4. to perform the Original Work publicly; and
+
+ 5. to display the Original Work publicly.
+
+ 2. Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works.
+
+ 3. Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work.
+
+ 4. Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license.
+
+ 5. External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c).
+
+ 6. Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work.
+
+ 7. Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer.
+
+ 8. Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation.
+
+ 9. Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including 'fair use' or 'fair dealing'). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c).
+
+ 10. Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware.
+
+ 11. Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License.
+
+ 12. Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License.
+
+ 13. Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable.
+
+ 14. Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+ 15. Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You.
+
+ 16. Modification of This License. This License is Copyright (C) 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Open Software License" or "OSL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under " or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process.
\ No newline at end of file
diff --git a/app/code/Magento/AdobeIms/LICENSE_AFL.txt b/app/code/Magento/AdobeIms/LICENSE_AFL.txt
new file mode 100644
index 0000000000000..f39d641b18a19
--- /dev/null
+++ b/app/code/Magento/AdobeIms/LICENSE_AFL.txt
@@ -0,0 +1,48 @@
+
+Academic Free License ("AFL") v. 3.0
+
+This Academic Free License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work:
+
+Licensed under the Academic Free License version 3.0
+
+ 1. Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following:
+
+ 1. to reproduce the Original Work in copies, either alone or as part of a collective work;
+
+ 2. to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work;
+
+ 3. to distribute or communicate copies of the Original Work and Derivative Works to the public, under any license of your choice that does not contradict the terms and conditions, including Licensor's reserved rights and remedies, in this Academic Free License;
+
+ 4. to perform the Original Work publicly; and
+
+ 5. to display the Original Work publicly.
+
+ 2. Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works.
+
+ 3. Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work.
+
+ 4. Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license.
+
+ 5. External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c).
+
+ 6. Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work.
+
+ 7. Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer.
+
+ 8. Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation.
+
+ 9. Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including "fair use" or "fair dealing"). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c).
+
+ 10. Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware.
+
+ 11. Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License.
+
+ 12. Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License.
+
+ 13. Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable.
+
+ 14. Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+ 15. Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You.
+
+ 16. Modification of This License. This License is Copyright © 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Academic Free License" or "AFL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under " or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process.
diff --git a/app/code/Magento/AdobeIms/Model/Config.php b/app/code/Magento/AdobeIms/Model/Config.php
new file mode 100644
index 0000000000000..4c30b4af2e02b
--- /dev/null
+++ b/app/code/Magento/AdobeIms/Model/Config.php
@@ -0,0 +1,129 @@
+scopeConfig = $scopeConfig;
+ $this->url = $url;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getApiKey(): ?string
+ {
+ return $this->scopeConfig->getValue(self::XML_PATH_API_KEY);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getPrivateKey(): string
+ {
+ return (string)$this->scopeConfig->getValue(self::XML_PATH_PRIVATE_KEY);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getTokenUrl(): string
+ {
+ return $this->scopeConfig->getValue(self::XML_PATH_TOKEN_URL);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getAuthUrl(): string
+ {
+ return str_replace(
+ ['#{client_id}', '#{redirect_uri}', '#{locale}'],
+ [$this->getApiKey(), $this->getCallBackUrl(), $this->getLocale()],
+ $this->scopeConfig->getValue(self::XML_PATH_AUTH_URL_PATTERN)
+ );
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getCallBackUrl(): string
+ {
+ return $this->url->getUrl(self::OAUTH_CALLBACK_URL);
+ }
+
+ /**
+ * Get locale
+ *
+ * @return string
+ */
+ private function getLocale(): string
+ {
+ return $this->scopeConfig->getValue(Custom::XML_PATH_GENERAL_LOCALE_CODE);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getLogoutUrl(string $accessToken, string $redirectUrl = '') : string
+ {
+ return str_replace(
+ ['#{access_token}', '#{redirect_uri}'],
+ [$accessToken, $redirectUrl],
+ $this->scopeConfig->getValue(self::XML_PATH_LOGOUT_URL_PATTERN)
+ );
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getProfileImageUrl(): string
+ {
+ return str_replace(
+ ['#{api_key}'],
+ [$this->getApiKey()],
+ $this->scopeConfig->getValue(self::XML_PATH_IMAGE_URL_PATTERN)
+ );
+ }
+}
diff --git a/app/code/Magento/AdobeIms/Model/FlushUserTokens.php b/app/code/Magento/AdobeIms/Model/FlushUserTokens.php
new file mode 100644
index 0000000000000..c7af6a408203a
--- /dev/null
+++ b/app/code/Magento/AdobeIms/Model/FlushUserTokens.php
@@ -0,0 +1,72 @@
+userContext = $userContext;
+ $this->userProfileRepository = $userProfileRepository;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function execute(int $adminUserId = null): void
+ {
+ try {
+ $adminUserId = $adminUserId ?? (int) $this->userContext->getUserId();
+ $userProfile = $this->userProfileRepository->getByUserId($adminUserId);
+ if (!$this->isTokenDataEmpty($userProfile)) {
+ $userProfile->setAccessToken('');
+ $userProfile->setRefreshToken('');
+ $this->userProfileRepository->save($userProfile);
+ }
+ } catch (\Exception $exception) { //phpcs:ignore Magento2.CodeAnalysis.EmptyBlock.DetectedCatch
+ // User profile and tokens are not present in the system
+ }
+ }
+
+ /**
+ * Checks if the tokens are empty
+ *
+ * @param UserProfileInterface $userProfile
+ * @return bool
+ */
+ private function isTokenDataEmpty(UserProfileInterface $userProfile) : bool
+ {
+ return empty($userProfile->getRefreshToken()) && empty($userProfile->getAccessToken());
+ }
+}
diff --git a/app/code/Magento/AdobeIms/Model/GetAccessToken.php b/app/code/Magento/AdobeIms/Model/GetAccessToken.php
new file mode 100644
index 0000000000000..4a5c4a49b9b9c
--- /dev/null
+++ b/app/code/Magento/AdobeIms/Model/GetAccessToken.php
@@ -0,0 +1,65 @@
+userContext = $userContext;
+ $this->userProfileRepository = $userProfileRepository;
+ $this->encryptor = $encryptor;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function execute(int $adminUserId = null): ?string
+ {
+ try {
+ $adminUserId = $adminUserId ?? (int) $this->userContext->getUserId();
+ return $this->encryptor->decrypt(
+ $this->userProfileRepository->getByUserId($adminUserId)->getAccessToken()
+ );
+ } catch (NoSuchEntityException $exception) {
+ return null;
+ }
+ }
+}
diff --git a/app/code/Magento/AdobeIms/Model/GetImage.php b/app/code/Magento/AdobeIms/Model/GetImage.php
new file mode 100644
index 0000000000000..5a9274d80682f
--- /dev/null
+++ b/app/code/Magento/AdobeIms/Model/GetImage.php
@@ -0,0 +1,103 @@
+logger = $logger;
+ $this->curlFactory = $curlFactory;
+ $this->config = $config;
+ $this->json = $json;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function execute(string $accessToken, int $size = 276): string
+ {
+ $image = '';
+ try {
+ $curl = $this->curlFactory->create();
+ $curl->addHeader('Content-Type', 'application/x-www-form-urlencoded');
+ $curl->addHeader('Authorization:', 'Bearer' . $accessToken);
+ $curl->addHeader('cache-control', 'no-cache');
+
+ $curl->get($this->config->getProfileImageUrl());
+ $result = $this->json->unserialize($curl->getBody());
+ if (!empty($result['user']) && !empty($result['user']['images'])) {
+ $image = $this->getImageSize($result['user']['images'], $size);
+ }
+ } catch (\Exception $exception) {
+ $this->logger->critical($exception);
+ }
+
+ return $image;
+ }
+
+ /**
+ * Get the profile image url of the requested size (or the biggest if requested size is not available)
+ *
+ * @param array $sizes
+ * @param int $size
+ */
+ private function getImageSize(array $sizes, int $size): string
+ {
+ if (empty($sizes)) {
+ return '';
+ }
+
+ if (isset($sizes[$size])) {
+ return $sizes[$size];
+ }
+
+ return end($sizes);
+ }
+}
diff --git a/app/code/Magento/AdobeIms/Model/GetToken.php b/app/code/Magento/AdobeIms/Model/GetToken.php
new file mode 100644
index 0000000000000..8a2ef8e07c873
--- /dev/null
+++ b/app/code/Magento/AdobeIms/Model/GetToken.php
@@ -0,0 +1,90 @@
+config = $config;
+ $this->curlFactory = $curlFactory;
+ $this->json = $json;
+ $this->tokenResponseFactory = $tokenResponseFactory;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function execute(string $code): TokenResponseInterface
+ {
+ $curl = $this->curlFactory->create();
+
+ $curl->addHeader('Content-Type', 'application/x-www-form-urlencoded');
+ $curl->addHeader('cache-control', 'no-cache');
+
+ $curl->post(
+ $this->config->getTokenUrl(),
+ [
+ 'grant_type' => 'authorization_code',
+ 'client_id' => $this->config->getApiKey(),
+ 'client_secret' => $this->config->getPrivateKey(),
+ 'code' => $code
+ ]
+ );
+
+ $response = $this->json->unserialize($curl->getBody());
+
+ if (!is_array($response) || empty($response['access_token'])) {
+ throw new AuthorizationException(__('Could not login to Adobe IMS.'));
+ }
+
+ return $this->tokenResponseFactory->create(['data' => $response]);
+ }
+}
diff --git a/app/code/Magento/AdobeIms/Model/LogIn.php b/app/code/Magento/AdobeIms/Model/LogIn.php
new file mode 100644
index 0000000000000..09a70e9d5ae47
--- /dev/null
+++ b/app/code/Magento/AdobeIms/Model/LogIn.php
@@ -0,0 +1,141 @@
+userProfileRepository = $userProfileRepository;
+ $this->userProfileFactory = $userProfileFactory;
+ $this->getUserImage = $getImage;
+ $this->encryptor = $encryptor;
+ $this->dateTime = $dateTime;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function execute(int $userId, TokenResponseInterface $tokenResponse): void
+ {
+ $this->userProfileRepository->save(
+ $this->updateUserProfile(
+ $this->getUserProfile($userId),
+ $tokenResponse
+ )
+ );
+ }
+
+ /**
+ * Update user profile with the data from token response
+ *
+ * @param UserProfileInterface $profile
+ * @param TokenResponseInterface $response
+ * @return UserProfileInterface
+ */
+ private function updateUserProfile(
+ UserProfileInterface $profile,
+ TokenResponseInterface $response
+ ): UserProfileInterface {
+ $profile->setName($response->getName());
+ $profile->setEmail($response->getEmail());
+ $profile->setImage($this->getUserImage->execute($response->getAccessToken()));
+ $profile->setAccessToken($this->encryptor->encrypt($response->getAccessToken()));
+ $profile->setRefreshToken($this->encryptor->encrypt($response->getRefreshToken()));
+ $profile->setAccessTokenExpiresAt($this->getExpiresTime($response->getExpiresIn()));
+
+ return $profile;
+ }
+
+ /**
+ * Get user profile entity
+ *
+ * @param int $userId
+ * @return UserProfileInterface
+ */
+ private function getUserProfile(int $userId): UserProfileInterface
+ {
+ try {
+ return $this->userProfileRepository->getByUserId($userId);
+ } catch (NoSuchEntityException $exception) {
+ return $this->userProfileFactory->create(
+ [
+ 'data' => [
+ 'admin_user_id' => $userId
+ ]
+ ]
+ );
+ }
+ }
+
+ /**
+ * Retrieve token expires date
+ *
+ * @param int $expiresIn
+ * @return string
+ */
+ private function getExpiresTime(int $expiresIn): string
+ {
+ return $this->dateTime->gmtDate(
+ self::DATE_FORMAT,
+ $this->dateTime->gmtTimestamp() + round($expiresIn / 1000)
+ );
+ }
+}
diff --git a/app/code/Magento/AdobeIms/Model/LogOut.php b/app/code/Magento/AdobeIms/Model/LogOut.php
new file mode 100644
index 0000000000000..db90ccf88f0e8
--- /dev/null
+++ b/app/code/Magento/AdobeIms/Model/LogOut.php
@@ -0,0 +1,114 @@
+logger = $logger;
+ $this->config = $config;
+ $this->curlFactory = $curlFactory;
+ $this->getAccessToken = $getAccessToken;
+ $this->flushUserTokens = $flushUserTokens;
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function execute() : bool
+ {
+ try {
+ $accessToken = $this->getAccessToken->execute();
+
+ if (empty($accessToken)) {
+ return true;
+ }
+
+ $this->externalLogOut($accessToken);
+ $this->flushUserTokens->execute();
+ return true;
+ } catch (\Exception $exception) {
+ $this->logger->critical($exception);
+ return false;
+ }
+ }
+
+ /**
+ * Logout user from Adobe IMS
+ *
+ * @param string $accessToken
+ * @throws LocalizedException
+ */
+ private function externalLogOut(string $accessToken): void
+ {
+ $curl = $this->curlFactory->create();
+ $curl->addHeader('Content-Type', 'application/x-www-form-urlencoded');
+ $curl->addHeader('cache-control', 'no-cache');
+ $curl->get($this->config->getLogoutUrl($accessToken));
+
+ if ($curl->getStatus() !== self::HTTP_FOUND) {
+ throw new LocalizedException(
+ __('An error occurred during logout operation.')
+ );
+ }
+ }
+}
diff --git a/app/code/Magento/AdobeIms/Model/OAuth/TokenResponse.php b/app/code/Magento/AdobeIms/Model/OAuth/TokenResponse.php
new file mode 100644
index 0000000000000..62cc0ee659ce4
--- /dev/null
+++ b/app/code/Magento/AdobeIms/Model/OAuth/TokenResponse.php
@@ -0,0 +1,129 @@
+getData(self::ACCESS_TOKEN);
+ }
+
+ /**
+ * Get refresh token
+ *
+ * @return string
+ */
+ public function getRefreshToken(): string
+ {
+ return (string)$this->getData(self::REFRESH_TOKEN);
+ }
+
+ /**
+ * Get sub
+ *
+ * @return string
+ */
+ public function getSub(): string
+ {
+ return (string)$this->getData(self::SUB);
+ }
+
+ /**
+ * Get name
+ *
+ * @return string
+ */
+ public function getName(): string
+ {
+ return (string)$this->getData(self::NAME);
+ }
+
+ /**
+ * Get token type
+ *
+ * @return string
+ */
+ public function getTokenType(): string
+ {
+ return (string)$this->getData(self::TOKEN_TYPE);
+ }
+
+ /**
+ * Get given name
+ *
+ * @return string
+ */
+ public function getGivenName(): string
+ {
+ return (string)$this->getData(self::GIVEN_NAME);
+ }
+
+ /**
+ * Get expires in
+ *
+ * @return int
+ */
+ public function getExpiresIn(): int
+ {
+ return (int)$this->getData(self::EXPIRES_IN);
+ }
+
+ /**
+ * Get family name
+ *
+ * @return string
+ */
+ public function getFamilyName(): string
+ {
+ return (string)$this->getData(self::FAMILY_NAME);
+ }
+
+ /**
+ * Get email
+ *
+ * @return string
+ */
+ public function getEmail(): string
+ {
+ return (string)$this->getData(self::EMAIL);
+ }
+
+ /**
+ * Get error code
+ *
+ * @return string
+ */
+ public function getError(): string
+ {
+ return (string)$this->getData(self::ERROR);
+ }
+}
diff --git a/app/code/Magento/AdobeIms/Model/ResourceModel/UserProfile.php b/app/code/Magento/AdobeIms/Model/ResourceModel/UserProfile.php
new file mode 100644
index 0000000000000..4c6edabf3d083
--- /dev/null
+++ b/app/code/Magento/AdobeIms/Model/ResourceModel/UserProfile.php
@@ -0,0 +1,28 @@
+_init(self::ADOBE_USER_PROFILE, self::ENTITY_ID);
+ }
+}
diff --git a/app/code/Magento/AdobeIms/Model/ResourceModel/UserProfile/Collection.php b/app/code/Magento/AdobeIms/Model/ResourceModel/UserProfile/Collection.php
new file mode 100644
index 0000000000000..9d401575a1842
--- /dev/null
+++ b/app/code/Magento/AdobeIms/Model/ResourceModel/UserProfile/Collection.php
@@ -0,0 +1,27 @@
+_init(UserProfileModel::class, UserProfileResource::class);
+ }
+}
diff --git a/app/code/Magento/AdobeIms/Model/UserAuthorized.php b/app/code/Magento/AdobeIms/Model/UserAuthorized.php
new file mode 100644
index 0000000000000..09070f69c1ed8
--- /dev/null
+++ b/app/code/Magento/AdobeIms/Model/UserAuthorized.php
@@ -0,0 +1,61 @@
+userContext = $userContext;
+ $this->userProfileRepository = $userProfileRepository;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function execute(int $adminUserId = null): bool
+ {
+ try {
+ $adminUserId = $adminUserId ?? (int) $this->userContext->getUserId();
+ $userProfile = $this->userProfileRepository->getByUserId($adminUserId);
+
+ return !empty($userProfile->getId())
+ && !empty($userProfile->getAccessToken())
+ && !empty($userProfile->getAccessTokenExpiresAt())
+ && strtotime($userProfile->getAccessTokenExpiresAt()) >= strtotime('now');
+ } catch (\Exception $exception) {
+ return false;
+ }
+ }
+}
diff --git a/app/code/Magento/AdobeIms/Model/UserProfile.php b/app/code/Magento/AdobeIms/Model/UserProfile.php
new file mode 100644
index 0000000000000..f1ef348654fa8
--- /dev/null
+++ b/app/code/Magento/AdobeIms/Model/UserProfile.php
@@ -0,0 +1,217 @@
+_init(UserProfileResource::class);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getUserId(): ?int
+ {
+ return $this->getData(self::USER_ID);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function setUserId(int $value): void
+ {
+ $this->setData(self::USER_ID, $value);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getName(): ?string
+ {
+ return $this->getData(self::NAME);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function setName(string $value): void
+ {
+ $this->setData(self::NAME, $value);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getEmail(): ?string
+ {
+ return $this->getData(self::EMAIL);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getImage(): ?string
+ {
+ return $this->getData(self::IMAGE);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function setImage(string $value): void
+ {
+ $this->setData(self::IMAGE, $value);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function setEmail(string $value): void
+ {
+ $this->setData(self::EMAIL, $value);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getAccountType(): ?string
+ {
+ return $this->getData(self::ACCOUNT_TYPE);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function setAccountType(string $value): void
+ {
+ $this->setData(self::ACCOUNT_TYPE, $value);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getAccessToken(): ?string
+ {
+ return $this->getData(self::ACCESS_TOKEN);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function setAccessToken(string $value): void
+ {
+ $this->setData(self::ACCESS_TOKEN, $value);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getRefreshToken(): ?string
+ {
+ return $this->getData(self::REFRESH_TOKEN);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function setRefreshToken(string $value): void
+ {
+ $this->setData(self::REFRESH_TOKEN, $value);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getCreatedAt(): ?string
+ {
+ return $this->getData(self::CREATED_AT);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function setCreatedAt(string $value): void
+ {
+ $this->setData(self::CREATED_AT, $value);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getUpdatedAt(): ?string
+ {
+ return $this->getData(self::UPDATED_AT);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function setUpdatedAt(string $value): void
+ {
+ $this->setData(self::UPDATED_AT, $value);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getAccessTokenExpiresAt(): ?string
+ {
+ return $this->getData(self::ACCESS_TOKEN_EXPIRES_AT);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function setAccessTokenExpiresAt(string $value): void
+ {
+ $this->setData(self::ACCESS_TOKEN_EXPIRES_AT, $value);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getExtensionAttributes(): UserProfileExtensionInterface
+ {
+ return $this->_getExtensionAttributes();
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function setExtensionAttributes(UserProfileExtensionInterface $extensionAttributes): void
+ {
+ $this->_setExtensionAttributes($extensionAttributes);
+ }
+}
diff --git a/app/code/Magento/AdobeIms/Model/UserProfileRepository.php b/app/code/Magento/AdobeIms/Model/UserProfileRepository.php
new file mode 100644
index 0000000000000..b22f9a96c4b3b
--- /dev/null
+++ b/app/code/Magento/AdobeIms/Model/UserProfileRepository.php
@@ -0,0 +1,108 @@
+resource = $resource;
+ $this->entityFactory = $entityFactory;
+ $this->logger = $logger;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function save(UserProfileInterface $entity): void
+ {
+ try {
+ $this->resource->save($entity);
+ $this->loadedEntities[$entity->getId()] = $entity;
+ } catch (Exception $exception) {
+ $this->logger->critical($exception);
+ throw new CouldNotSaveException(__('Could not save user profile.'), $exception);
+ }
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function get(int $entityId): UserProfileInterface
+ {
+ if (isset($this->loadedEntities[$entityId])) {
+ return $this->loadedEntities[$entityId];
+ }
+
+ $entity = $this->entityFactory->create();
+ $this->resource->load($entity, $entityId);
+ if (!$entity->getId()) {
+ throw new NoSuchEntityException(__('Could not find user profile id: %id.', ['id' => $entityId]));
+ }
+
+ return $this->loadedEntities[$entity->getId()] = $entity;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function getByUserId(int $userId): UserProfileInterface
+ {
+ $entity = $this->entityFactory->create();
+ $this->resource->load($entity, $userId, self::ADMIN_USER_ID);
+ if (!$entity->getId()) {
+ throw new NoSuchEntityException(__('Could not find user profile id: %id.', ['id' => $userId]));
+ }
+
+ return $this->loadedEntities[$entity->getId()] = $entity;
+ }
+}
diff --git a/app/code/Magento/AdobeIms/Observer/FlushUsersTokensObserver.php b/app/code/Magento/AdobeIms/Observer/FlushUsersTokensObserver.php
new file mode 100644
index 0000000000000..40c7d3c692ff0
--- /dev/null
+++ b/app/code/Magento/AdobeIms/Observer/FlushUsersTokensObserver.php
@@ -0,0 +1,65 @@
+flushUserTokens = $flushUserTokens;
+ }
+
+ /**
+ * Flushes admin user tokens
+ *
+ * @param \Magento\Framework\Event\Observer $observer
+ */
+ public function execute(\Magento\Framework\Event\Observer $observer): void
+ {
+ /** @var RequestInterface $request */
+ $request = $observer->getDataByKey('request');
+ $resources = $request->getParam('resource', false);
+ if (is_array($resources) && !$this->roleHasImsLogoutResource($resources)) {
+ /** @var Role $role */
+ $role = $observer->getDataByKey('object');
+ $users = $role->getRoleUsers();
+ foreach ($users as $userId) {
+ $this->flushUserTokens->execute((int) $userId);
+ }
+ }
+ }
+
+ /**
+ * Checks if the role has IMS Logout resource
+ *
+ * @param array $resources
+ * @return bool
+ */
+ private function roleHasImsLogoutResource(array $resources): bool
+ {
+ return in_array(Logout::ADMIN_RESOURCE, $resources);
+ }
+}
diff --git a/app/code/Magento/AdobeIms/README.md b/app/code/Magento/AdobeIms/README.md
new file mode 100644
index 0000000000000..19d1ac19c6d0a
--- /dev/null
+++ b/app/code/Magento/AdobeIms/README.md
@@ -0,0 +1,23 @@
+# Magento_AdobeIms module
+
+The Magento_AdobeIms module is responsible for authentication to Adobe services.
+
+## Installation details
+
+The Magento_AdobeIms module creates the following tables in the database:
+
+- `adobe_user_profile`
+
+Before disabling or uninstalling this module, note that the `Magento_AdobeStockImageAdminUi` module depends on this module.
+
+For information about module installation in Magento 2, see [Enable or disable modules](https://devdocs.magento.com/guides/v2.4/install-gde/install/cli/install-cli-subcommands-enable.html).
+
+## Extensibility
+
+Extension developers can interact with the Magento_AdobeIms module. For more information about the Magento extension mechanism, see [Magento plug-ins](https://devdocs.magento.com/guides/v2.4/extension-dev-guide/plugins.html).
+
+[The Magento dependency injection mechanism](https://devdocs.magento.com/guides/v2.4/extension-dev-guide/depend-inj.html) enables you to override the functionality of the Magento_AdobeIms module.
+
+## Additional information
+
+For information about significant changes in patch releases, see [2.4.x Release information](https://devdocs.magento.com/guides/v2.4/release-notes/bk-release-notes.html).
diff --git a/app/code/Magento/AdobeIms/Test/Integration/DbSchemaTest.php b/app/code/Magento/AdobeIms/Test/Integration/DbSchemaTest.php
new file mode 100644
index 0000000000000..0317af4f665a2
--- /dev/null
+++ b/app/code/Magento/AdobeIms/Test/Integration/DbSchemaTest.php
@@ -0,0 +1,40 @@
+validator = Bootstrap::getObjectManager()->get(UpToDateDeclarativeSchema::class);
+ }
+
+ /**
+ * Test for db schema
+ */
+ public function testDbSchemaUpToDate(): void
+ {
+ $this->assertTrue($this->validator->isUpToDate());
+ }
+}
diff --git a/app/code/Magento/AdobeIms/Test/Integration/Model/ConfigTest.php b/app/code/Magento/AdobeIms/Test/Integration/Model/ConfigTest.php
new file mode 100644
index 0000000000000..a67773a174a1f
--- /dev/null
+++ b/app/code/Magento/AdobeIms/Test/Integration/Model/ConfigTest.php
@@ -0,0 +1,48 @@
+model = Bootstrap::getObjectManager()->get(Config::class);
+ }
+
+ /**
+ * Test for getAuthUrl().
+ */
+ public function testGetAuthUrl(): void
+ {
+ $result = $this->model->getAuthUrl();
+
+ $this->assertStringContainsString('scope=' . implode(',', self::SCOPES), $result);
+ $this->assertStringContainsString('locale=' . self::LOCALE, $result);
+ $this->assertMatchesRegularExpression(self::REDIRECT_URL_PATTERN, $result);
+ }
+}
diff --git a/app/code/Magento/AdobeIms/Test/Unit/Block/Adminhtml/SignInTest.php b/app/code/Magento/AdobeIms/Test/Unit/Block/Adminhtml/SignInTest.php
new file mode 100644
index 0000000000000..ad54e011873b0
--- /dev/null
+++ b/app/code/Magento/AdobeIms/Test/Unit/Block/Adminhtml/SignInTest.php
@@ -0,0 +1,284 @@
+createMock(ConfigInterface::class);
+ $configMock->expects($this->once())
+ ->method('getAuthUrl')
+ ->willReturn(self::AUTH_URL);
+
+ $urlBuilderMock = $this->createMock(UrlInterface::class);
+ $urlBuilderMock->method('getUrl')
+ ->willReturn(self::PROFILE_URL);
+ $contextMock = $this->createMock(Context::class);
+ $contextMock->method('getUrlBuilder')
+ ->willReturn($urlBuilderMock);
+
+ $this->userContextMock = $this->createMock(UserContextInterface::class);
+ $this->userAuthorizedMock = $this->createMock(UserAuthorizedInterface::class);
+ $this->userProfileRepositoryMock = $this->createMock(UserProfileRepositoryInterface::class);
+ $this->jsonHexTag = $this->createMock(JsonHexTag::class);
+
+ $objectManager = new ObjectManager($this);
+ $this->signInBlock = $objectManager->getObject(
+ SignInBlock::class,
+ [
+ 'config' => $configMock,
+ 'context' => $contextMock,
+ 'userContext' => $this->userContextMock,
+ 'userAuthorized' => $this->userAuthorizedMock,
+ 'userProfileRepository' => $this->userProfileRepositoryMock,
+ 'json' => $this->jsonHexTag
+ ]
+ );
+ }
+
+ /**
+ * @dataProvider userDataProvider
+ * @param int $userId
+ * @param bool $userExists
+ * @param array $userData
+ * @param array $configProviderData
+ * @param array $expectedData
+ */
+ public function testGetComponentJsonConfig(
+ int $userId,
+ bool $userExists,
+ array $userData,
+ array $configProviderData,
+ array $expectedData
+ ): void {
+ $this->userAuthorizedMock->expects($this->once())
+ ->method('execute')
+ ->willReturn($userData['isAuthorized']);
+
+ $userProfile = $this->createMock(UserProfileInterface::class);
+ $userProfile->method('getName')->willReturn($userData['name']);
+ $userProfile->method('getEmail')->willReturn($userData['email']);
+ $userProfile->method('getImage')->willReturn($userData['image']);
+
+ $this->userContextMock->expects($this->any())
+ ->method('getUserId')
+ ->willReturn($userId);
+
+ $userRepositoryWillReturn = $userExists
+ ? $this->returnValue($userProfile)
+ : $this->throwException(new NoSuchEntityException());
+ $this->userProfileRepositoryMock
+ ->method('getByUserId')
+ ->with($userId)
+ ->will($userRepositoryWillReturn);
+
+ $configProviderMock = $this->createMock(ConfigProviderInterface::class);
+ $configProviderMock->expects($this->any())
+ ->method('get')
+ ->willReturn($configProviderData);
+ $this->signInBlock->setData('configProviders', [$configProviderMock]);
+
+ $serializedResult = 'Some result';
+ $this->jsonHexTag->expects($this->once())
+ ->method('serialize')
+ ->with($expectedData)
+ ->willReturn($serializedResult);
+
+ $this->assertEquals($serializedResult, $this->signInBlock->getComponentJsonConfig());
+ }
+
+ /**
+ * Returns default component config
+ *
+ * @param array $userData
+ * @return array
+ */
+ private function getDefaultComponentConfig(array $userData): array
+ {
+ return [
+ 'component' => 'Magento_AdobeIms/js/signIn',
+ 'template' => 'Magento_AdobeIms/signIn',
+ 'profileUrl' => self::PROFILE_URL,
+ 'logoutUrl' => self::LOGOUT_URL,
+ 'user' => $userData,
+ 'loginConfig' => [
+ 'url' => self::AUTH_URL,
+ 'callbackParsingParams' => [
+ 'regexpPattern' => self::RESPONSE_REGEXP_PATTERN,
+ 'codeIndex' => self::RESPONSE_CODE_INDEX,
+ 'messageIndex' => self::RESPONSE_MESSAGE_INDEX,
+ 'successCode' => self::RESPONSE_SUCCESS_CODE,
+ 'errorCode' => self::RESPONSE_ERROR_CODE
+ ]
+ ]
+ ];
+ }
+
+ /**
+ * Returns config from an additional config provider
+ *
+ * @return array
+ */
+ private function getConfigProvideConfig(): array
+ {
+ return [
+ 'component' => 'Magento_AdobeIms/js/test',
+ 'template' => 'Magento_AdobeIms/test',
+ 'profileUrl' => '',
+ 'logoutUrl' => '',
+ 'user' => [],
+ 'loginConfig' => [
+ 'url' => 'https://sometesturl.test',
+ 'callbackParsingParams' => [
+ 'regexpPattern' => self::RESPONSE_REGEXP_PATTERN,
+ 'codeIndex' => self::RESPONSE_CODE_INDEX,
+ 'messageIndex' => self::RESPONSE_MESSAGE_INDEX,
+ 'successCode' => self::RESPONSE_SUCCESS_CODE,
+ 'errorCode' => self::RESPONSE_ERROR_CODE
+ ]
+ ]
+ ];
+ }
+
+ /**
+ * Get default user data for an assertion
+ *
+ * @return array
+ */
+ private function getDefaultUserData(): array
+ {
+ return [
+ 'isAuthorized' => false,
+ 'name' => '',
+ 'email' => '',
+ 'image' => '',
+ ];
+ }
+
+ /**
+ * @return array
+ */
+ public function userDataProvider(): array
+ {
+ return [
+ 'Existing authorized user' => [
+ 11,
+ true,
+ [
+ 'isAuthorized' => true,
+ 'name' => 'John',
+ 'email' => 'john@email.com',
+ 'image' => 'image.png'
+ ],
+ [],
+ $this->getDefaultComponentConfig([
+ 'isAuthorized' => true,
+ 'name' => 'John',
+ 'email' => 'john@email.com',
+ 'image' => 'image.png'
+ ])
+ ],
+ 'Existing non-authorized user' => [
+ 12,
+ true,
+ [
+ 'isAuthorized' => false,
+ 'name' => 'John',
+ 'email' => 'john@email.com',
+ 'image' => 'image.png'
+ ],
+ [],
+ $this->getDefaultComponentConfig($this->getDefaultUserData()),
+ ],
+ 'Non-existing user' => [
+ 13,
+ false, //user doesn't exist
+ [
+ 'isAuthorized' => true,
+ 'name' => 'John',
+ 'email' => 'john@email.com',
+ 'image' => 'image.png'
+ ],
+ [],
+ $this->getDefaultComponentConfig($this->getDefaultUserData()),
+ ],
+ 'Existing user with additional config provider' => [
+ 14,
+ true,
+ [
+ 'isAuthorized' => false,
+ 'name' => 'John',
+ 'email' => 'john@email.com',
+ 'image' => 'image.png'
+ ],
+ $this->getConfigProvideConfig(),
+ array_replace_recursive(
+ $this->getDefaultComponentConfig($this->getDefaultUserData()),
+ $this->getConfigProvideConfig()
+ )
+ ]
+ ];
+ }
+}
diff --git a/app/code/Magento/AdobeIms/Test/Unit/Controller/Adminhtml/OAuth/CallbackTest.php b/app/code/Magento/AdobeIms/Test/Unit/Controller/Adminhtml/OAuth/CallbackTest.php
new file mode 100644
index 0000000000000..aee0ef226ea80
--- /dev/null
+++ b/app/code/Magento/AdobeIms/Test/Unit/Controller/Adminhtml/OAuth/CallbackTest.php
@@ -0,0 +1,126 @@
+authMock = $this->createMock(Auth::class);
+ $this->resultFactory = $this->createMock(ResultFactory::class);
+ $this->context = $objectManager->getObject(
+ Context::class,
+ [
+ 'auth' => $this->authMock,
+ 'resultFactory' => $this->resultFactory
+ ]
+ );
+ $this->user = $this->createMock(User::class);
+ $this->getToken = $this->createMock(GetTokenInterface::class);
+ $this->login = $this->createMock(LogInInterface::class);
+ $this->callback = $objectManager->getObject(
+ Callback::class,
+ [
+ 'context' => $this->context,
+ 'getToken' => $this->getToken,
+ 'login' => $this->login
+ ]
+ );
+ }
+
+ /**
+ * Authentication callback controller test
+ */
+ public function testExecute(): void
+ {
+ $userId = 55;
+ $token = $this->createMock(TokenResponseInterface::class);
+
+ $this->authMock->method('getUser')
+ ->will($this->returnValue($this->user));
+ $this->user->method('getId')
+ ->willReturn($userId);
+
+ $this->getToken->expects($this->once())
+ ->method('execute')
+ ->willReturn($token);
+ $this->login->expects($this->once())
+ ->method('execute')
+ ->with($userId, $token);
+
+ $result = $this->createMock(Raw::class);
+ $result->expects($this->once())
+ ->method('setContents')
+ ->with('auth[code=success;message=Authorization was successful]')
+ ->willReturnSelf();
+ $this->resultFactory->expects($this->once())
+ ->method('create')
+ ->willReturn($result);
+
+ $this->assertEquals($result, $this->callback->execute());
+ }
+}
diff --git a/app/code/Magento/AdobeIms/Test/Unit/Controller/Adminhtml/User/LogoutTest.php b/app/code/Magento/AdobeIms/Test/Unit/Controller/Adminhtml/User/LogoutTest.php
new file mode 100644
index 0000000000000..256850897a3ee
--- /dev/null
+++ b/app/code/Magento/AdobeIms/Test/Unit/Controller/Adminhtml/User/LogoutTest.php
@@ -0,0 +1,103 @@
+logoutInterfaceMock = $this->createMock(LogOutInterface::class);
+ $this->context = $this->createMock(ActionContext::class);
+ $this->resultFactory = $this->createMock(ResultFactory::class);
+ $this->context->expects($this->once())
+ ->method('getResultFactory')
+ ->willReturn($this->resultFactory);
+
+ $this->jsonObject = $this->createMock(Json::class);
+ $this->resultFactory->expects($this->once())->method('create')->with('json')->willReturn($this->jsonObject);
+
+ $this->getLogout = new Logout(
+ $this->context,
+ $this->logoutInterfaceMock
+ );
+ }
+
+ /**
+ * Verify that user can be logout
+ */
+ public function testExecute(): void
+ {
+ $this->logoutInterfaceMock->expects($this->once())
+ ->method('execute')
+ ->willReturn(true);
+ $data = ['success' => true];
+ $this->jsonObject->expects($this->once())->method('setHttpResponseCode')->with(200);
+ $this->jsonObject->expects($this->once())->method('setData')
+ ->with($this->equalTo($data));
+ $this->getLogout->execute();
+ }
+
+ /**
+ * Verify that return will be false if there is an error in logout.
+ * @throws NotFoundException
+ */
+ public function testExecuteWithError(): void
+ {
+ $result = [
+ 'success' => false,
+ ];
+ $this->logoutInterfaceMock->expects($this->once())
+ ->method('execute')
+ ->willReturn(false);
+ $this->jsonObject->expects($this->once())->method('setHttpResponseCode')->with(500);
+ $this->jsonObject->expects($this->once())->method('setData')
+ ->with($this->equalTo($result));
+ $this->getLogout->execute();
+ }
+}
diff --git a/app/code/Magento/AdobeIms/Test/Unit/Controller/Adminhtml/User/ProfileTest.php b/app/code/Magento/AdobeIms/Test/Unit/Controller/Adminhtml/User/ProfileTest.php
new file mode 100644
index 0000000000000..520c14c149b8d
--- /dev/null
+++ b/app/code/Magento/AdobeIms/Test/Unit/Controller/Adminhtml/User/ProfileTest.php
@@ -0,0 +1,154 @@
+action = $this->createMock(Context::class);
+
+ $this->userContext = $this->createMock(UserContextInterface::class);
+ $this->userProfileRepository = $this->createMock(UserProfileRepositoryInterface::class);
+ $this->logger = $this->createMock(LoggerInterface::class);
+ $this->jsonObject = $this->createMock(Json::class);
+ $this->resultFactory = $this->createMock(ResultFactory::class);
+ $this->action->expects($this->once())
+ ->method('getResultFactory')
+ ->willReturn($this->resultFactory);
+ $this->resultFactory->expects($this->once())->method('create')->with('json')->willReturn($this->jsonObject);
+ $this->profile = new Profile(
+ $this->action,
+ $this->userContext,
+ $this->userProfileRepository,
+ $this->logger
+ );
+ }
+
+ /**
+ * Ensure that User Profile data can be returned.
+ *
+ * @dataProvider userDataProvider
+ * @param array $result
+ * @throws NotFoundException
+ */
+ public function testExecute(array $result): void
+ {
+ $this->userContext->expects($this->once())->method('getUserId')->willReturn(1);
+ $userProfileMock = $this->createMock(UserProfileInterface::class);
+ $userProfileMock->expects($this->once())->method('getEmail')->willReturn('exaple@adobe.com');
+ $userProfileMock->expects($this->once())->method('getName')->willReturn('Smith');
+ $userProfileMock->expects($this->once())->method('getImage')->willReturn('https://adobe.com/sample-image.png');
+
+ $this->userProfileRepository->expects($this->exactly(1))
+ ->method('getByUserId')
+ ->willReturn($userProfileMock);
+
+ $this->jsonObject->expects($this->once())->method('setHttpResponseCode')->with(200);
+ $this->jsonObject->expects($this->once())->method('setData')
+ ->with($this->equalTo($result));
+ $this->assertEquals($this->jsonObject, $this->profile->execute());
+ }
+
+ /**
+ * Execute with exception
+ */
+ public function testExecuteWithExecption(): void
+ {
+ $this->userContext->expects($this->once())->method('getUserId')->willReturn(null);
+ $this->userProfileRepository->expects($this->exactly(1))
+ ->method('getByUserId')
+ ->willThrowException(new NoSuchEntityException());
+ $result = [
+ 'success' => false,
+ 'message' => __('An error occurred during get user data. Contact support.'),
+ ];
+ $this->jsonObject->expects($this->once())->method('setHttpResponseCode')->with(500);
+ $this->jsonObject->expects($this->once())->method('setData')
+ ->with($this->equalTo($result));
+ $this->profile->execute();
+ }
+
+ /**
+ * User data provider
+ *
+ * @return array
+ */
+ public function userDataProvider(): array
+ {
+ return
+ [
+ [
+ [
+ 'success' => true,
+ 'error_message' => '',
+ 'result' => [
+ 'email' => 'exaple@adobe.com',
+ 'name' => 'Smith',
+ 'image' => 'https://adobe.com/sample-image.png'
+ ]
+ ]
+ ]
+ ];
+ }
+}
diff --git a/app/code/Magento/AdobeIms/Test/Unit/Model/ConfigTest.php b/app/code/Magento/AdobeIms/Test/Unit/Model/ConfigTest.php
new file mode 100644
index 0000000000000..821b77c57246c
--- /dev/null
+++ b/app/code/Magento/AdobeIms/Test/Unit/Model/ConfigTest.php
@@ -0,0 +1,218 @@
+scopeConfigMock = $this->createMock(ScopeConfigInterface::class);
+ $this->urlMock = $this->createMock(UrlInterface::class);
+
+ $this->config = new Config($this->scopeConfigMock, $this->urlMock);
+ }
+
+ /**
+ * Test for \Magento\AdobeIms\Model\Config::getApiKey
+ */
+ public function testGetApiKey(): void
+ {
+ $this->scopeConfigMock->method('getValue')
+ ->with(self::XML_PATH_API_KEY)
+ ->willReturn(self::API_KEY);
+
+ $this->assertEquals(self::API_KEY, $this->config->getApiKey());
+ }
+
+ /**
+ * Test for \Magento\AdobeIms\Model\self::getPrivateKey
+ */
+ public function testGetPrivateKey(): void
+ {
+ $this->scopeConfigMock->method('getValue')
+ ->with(self::XML_PATH_PRIVATE_KEY)
+ ->willReturn(self::PRIVATE_KEY);
+
+ $this->assertEquals(self::PRIVATE_KEY, $this->config->getPrivateKey());
+ }
+
+ /**
+ * Test for \Magento\AdobeIms\Model\Config::getTokenUrl
+ */
+ public function testGetTokenUrl(): void
+ {
+ $this->scopeConfigMock->method('getValue')
+ ->with(self::XML_PATH_TOKEN_URL)
+ ->willReturn(self::TOKEN_URL);
+
+ $this->assertEquals(self::TOKEN_URL, $this->config->getTokenUrl());
+ }
+
+ /**
+ * Test for \Magento\AdobeIms\Model\Config::getAuthUrl
+ */
+ public function testGetAuthUrl(): void
+ {
+ $this->scopeConfigMock->method('getValue')
+ ->willReturnMap([
+ [
+ self::XML_PATH_API_KEY, ScopeConfigInterface::SCOPE_TYPE_DEFAULT, null,
+ self::API_KEY
+ ],
+ [
+ Custom::XML_PATH_GENERAL_LOCALE_CODE, ScopeConfigInterface::SCOPE_TYPE_DEFAULT, null,
+ self::LOCALE_CODE
+ ],
+ [
+ self::XML_PATH_AUTH_URL_PATTERN, ScopeConfigInterface::SCOPE_TYPE_DEFAULT, null,
+ self::AUTH_URL_PATTERN
+ ]
+ ]);
+
+ $this->urlMock->method('getUrl')->willReturn(self::CALLBACK_URL);
+
+ $this->assertEquals(
+ 'https://auth-url.com/pattern?client_id=' . self::API_KEY .
+ '&redirect_uri=' . self::CALLBACK_URL .
+ '&locale=' . self::LOCALE_CODE,
+ $this->config->getAuthUrl()
+ );
+ }
+
+ /**
+ * Test for \Magento\AdobeIms\Model\Config::getCallBackUrl
+ */
+ public function testGetCallBackUrl(): void
+ {
+ $this->urlMock->method('getUrl')
+ ->with('adobe_ims/oauth/callback')
+ ->willReturn(self::CALLBACK_URL);
+
+ $this->assertEquals(self::CALLBACK_URL, $this->config->getCallBackUrl());
+ }
+
+ /**
+ * Test for \Magento\AdobeIms\Model\Config::getLogoutUrl
+ */
+ public function testGetLogoutUrl(): void
+ {
+ $this->scopeConfigMock->method('getValue')
+ ->with(self::XML_PATH_LOGOUT_URL_PATTERN)
+ ->willReturn(self::LOGOUT_URL_PATTERN);
+
+ $this->assertEquals(
+ 'https://logout-url.com/pattern?access_token=' . self::ACCCESS_TOKEN .
+ '&redirect_uri=' . self::REDIRECT_URI,
+ $this->config->getLogoutUrl(self::ACCCESS_TOKEN, self::REDIRECT_URI)
+ );
+ }
+
+ /**
+ * Test for \Magento\AdobeIms\Model\Config::getProfileImageUrl
+ */
+ public function testGetProfileImageUrl(): void
+ {
+ $this->scopeConfigMock->method('getValue')
+ ->willReturnMap([
+ [
+ self::XML_PATH_IMAGE_URL_PATTERN, ScopeConfigInterface::SCOPE_TYPE_DEFAULT, null,
+ self::IMAGE_URL_PATTERN
+ ],
+ [
+ self::XML_PATH_API_KEY, ScopeConfigInterface::SCOPE_TYPE_DEFAULT, null,
+ self::API_KEY
+ ]
+ ]);
+
+ $this->assertEquals(
+ 'https://image-url.com/pattern?api_key=' . self::API_KEY,
+ $this->config->getProfileImageUrl()
+ );
+ }
+}
diff --git a/app/code/Magento/AdobeIms/Test/Unit/Model/FlushUserTokensTest.php b/app/code/Magento/AdobeIms/Test/Unit/Model/FlushUserTokensTest.php
new file mode 100644
index 0000000000000..a0b3d696ca515
--- /dev/null
+++ b/app/code/Magento/AdobeIms/Test/Unit/Model/FlushUserTokensTest.php
@@ -0,0 +1,90 @@
+userContext = $this->createMock(UserContextInterface::class);
+ $this->userProfileRepository = $this->createMock(UserProfileRepositoryInterface::class);
+
+ $this->flushTokens = new FlushUserTokens(
+ $this->userContext,
+ $this->userProfileRepository
+ );
+ }
+
+ /**
+ * Test flush tokens
+ */
+ public function testExecute(): void
+ {
+ $this->userContext->expects($this->once())->method('getUserId')->willReturn(1);
+ $userProfileMock = $this->createMock(UserProfileInterface::class);
+ $userProfileMock->method('getAccessToken')->willReturn('access-token');
+ $userProfileMock->method('getRefreshToken')->willReturn('request-token');
+ $this->userProfileRepository->expects($this->exactly(1))
+ ->method('getByUserId')
+ ->willReturn($userProfileMock);
+ $userProfileMock->expects($this->once())->method('setAccessToken')->willReturnSelf();
+ $userProfileMock->expects($this->once())->method('setRefreshToken')->willReturnSelf();
+ $this->userProfileRepository->expects($this->once())->method('save')
+ ->with($userProfileMock)->willReturnSelf();
+ $this->flushTokens->execute();
+ }
+
+ /**
+ * Test execute with empty tokens
+ */
+ public function testExecuteEmptyTokens(): void
+ {
+ $this->userContext->expects($this->once())->method('getUserId')->willReturn(1);
+ $userProfileMock = $this->createMock(UserProfileInterface::class);
+ $userProfileMock->method('getAccessToken')->willReturn('');
+ $userProfileMock->method('getRefreshToken')->willReturn('');
+ $this->userProfileRepository->expects($this->exactly(1))
+ ->method('getByUserId')
+ ->willReturn($userProfileMock);
+
+ $userProfileMock->expects($this->never())->method('setAccessToken')->willReturnSelf();
+ $userProfileMock->expects($this->never())->method('setRefreshToken')->willReturnSelf();
+ $this->userProfileRepository->expects($this->never())->method('save')
+ ->with($userProfileMock)->willReturnSelf();
+ $this->flushTokens->execute();
+ }
+}
diff --git a/app/code/Magento/AdobeIms/Test/Unit/Model/GetAccessTokenTest.php b/app/code/Magento/AdobeIms/Test/Unit/Model/GetAccessTokenTest.php
new file mode 100644
index 0000000000000..a6fd4d9655c3e
--- /dev/null
+++ b/app/code/Magento/AdobeIms/Test/Unit/Model/GetAccessTokenTest.php
@@ -0,0 +1,115 @@
+userContext = $this->createMock(UserContextInterface::class);
+ $this->userProfile = $this->createMock(UserProfileRepositoryInterface::class);
+ $this->encryptor = $this->createMock(EncryptorInterface::class);
+
+ $this->getAccessToken = new GetAccessToken(
+ $this->userContext,
+ $this->userProfile,
+ $this->encryptor
+ );
+ }
+
+ /**
+ * Test save.
+ *
+ * @param string|null $token
+ * @dataProvider expectedDataProvider
+ */
+ public function testExecute(?string $token): void
+ {
+ $this->userContext->expects($this->once())->method('getUserId')->willReturn(1);
+ $userProfileMock = $this->createMock(UserProfileInterface::class);
+ $this->userProfile->expects($this->exactly(1))
+ ->method('getByUserId')
+ ->willReturn($userProfileMock);
+ $userProfileMock->expects($this->once())->method('getAccessToken')->willReturn($token);
+
+ $decryptedToken = $token ?? '';
+
+ $this->encryptor->expects($this->once())
+ ->method('decrypt')
+ ->with($token)
+ ->willReturn($decryptedToken);
+
+ $this->assertEquals($token, $this->getAccessToken->execute());
+ }
+
+ /**
+ * Test execute with exception
+ */
+ public function testExecuteWIthException(): void
+ {
+ $this->userContext->expects($this->once())->method('getUserId')->willReturn(1);
+ $this->userProfile->expects($this->exactly(1))
+ ->method('getByUserId')
+ ->willThrowException(new NoSuchEntityException());
+
+ $this->getAccessToken->execute();
+ }
+
+ /**
+ * Data provider for get acces token method.
+ *
+ * @return array
+ */
+ public function expectedDataProvider(): array
+ {
+ return
+ [
+ [
+ 'token' => 'kladjflakdjf3423rfzddsf'
+ ],
+ [
+ 'null_token' => null
+ ]
+ ];
+ }
+}
diff --git a/app/code/Magento/AdobeIms/Test/Unit/Model/GetImageTest.php b/app/code/Magento/AdobeIms/Test/Unit/Model/GetImageTest.php
new file mode 100644
index 0000000000000..db1033a511fcc
--- /dev/null
+++ b/app/code/Magento/AdobeIms/Test/Unit/Model/GetImageTest.php
@@ -0,0 +1,136 @@
+curlFactoryMock = $this->createMock(CurlFactory::class);
+ $this->jsonMock = $this->createMock(Json::class);
+ $this->logger = $this->createMock(LoggerInterface::class);
+ $this->configInterface = $this->createMock(ConfigInterface::class);
+
+ $this->getImage = new GetImage(
+ $this->logger,
+ $this->curlFactoryMock,
+ $this->configInterface,
+ $this->jsonMock
+ );
+ }
+
+ /**
+ * Test save.
+ *
+ * @dataProvider imagesDataProvider
+ * @param array $expectedResult
+ * @param string $expectedImageUrl
+ */
+ public function testExecute(array $expectedResult, string $expectedImageUrl): void
+ {
+ $curl = $this->createMock(Curl::class);
+ $this->curlFactoryMock->expects($this->once())
+ ->method('create')
+ ->willReturn($curl);
+ $curl->expects($this->exactly(3))
+ ->method('addHeader')
+ ->willReturn(null);
+ $this->configInterface->expects($this->once())
+ ->method('getProfileImageUrl')
+ ->willReturn('https://adbobe.com/some/image/url');
+ $curl->expects($this->once())
+ ->method('get')
+ ->willReturn(null);
+ $this->jsonMock->expects($this->once())
+ ->method('unserialize')
+ ->willReturn($expectedResult);
+
+ $this->assertEquals($expectedImageUrl, $this->getImage->execute('code'));
+ }
+
+ /**
+ * Get Image with exception
+ */
+ public function testGetImageWithException(): void
+ {
+ $this->curlFactoryMock->expects($this->once())
+ ->method('create')
+ ->willThrowException(new \Exception());
+ $this->logger->expects($this->any())
+ ->method('critical')
+ ->willReturnSelf();
+ $this->getImage->execute('code');
+ }
+
+ /**
+ * Images data provider.
+ *
+ * @return array
+ */
+ public function imagesDataProvider(): array
+ {
+ return [
+ [
+ 'expected_result' => [
+ 'user' => [
+ 'images' => [
+ 50 => 'https://mir-s3-cdn-cf.behance.net/user/50/61269e393218159.5d8e3b72bcfb9.jpg',
+ 100 => 'https://mir-s3-cdn-cf.behance.net/user/100/61269e393218159.5d8e3b72bcfb9.jpg',
+ 115 => 'https://mir-s3-cdn-cf.behance.net/user/115/61269e393218159.5d8e3b72bcfb9.jpg',
+ 230 => 'https://mir-s3-cdn-cf.behance.net/user/230/61269e393218159.5d8e3b72bcfb9.jpg',
+ 138 => 'https://mir-s3-cdn-cf.behance.net/user/138/61269e393218159.5d8e3b72bcfb9.jpg',
+ 276 => 'https://mir-s3-cdn-cf.behance.net/user/276/61269e393218159.5d8e3b72bcfb9.jpg',
+ ],
+ ],
+ 'http_code' => 200,
+ ],
+ 'expected_image_url' => 'https://mir-s3-cdn-cf.behance.net/user/276/61269e393218159.5d8e3b72bcfb9.jpg'
+ ]
+ ];
+ }
+}
diff --git a/app/code/Magento/AdobeIms/Test/Unit/Model/GetTokenTest.php b/app/code/Magento/AdobeIms/Test/Unit/Model/GetTokenTest.php
new file mode 100644
index 0000000000000..b98b19f398266
--- /dev/null
+++ b/app/code/Magento/AdobeIms/Test/Unit/Model/GetTokenTest.php
@@ -0,0 +1,104 @@
+configMock = $this->createMock(ConfigInterface::class);
+ $this->curlFactoryMock = $this->createMock(CurlFactory::class);
+ $this->jsonMock = $this->createMock(Json::class);
+ $this->tokenResponseFactoryMock = $this->createMock(TokenResponseInterfaceFactory::class);
+ $this->getToken = new GetToken(
+ $this->configMock,
+ $this->curlFactoryMock,
+ $this->jsonMock,
+ $this->tokenResponseFactoryMock
+ );
+ }
+
+ /**
+ * Test save.
+ */
+ public function testExecute(): void
+ {
+ $curl = $this->createMock(Curl::class);
+ $this->curlFactoryMock->expects($this->once())
+ ->method('create')
+ ->willReturn($curl);
+ $curl->expects($this->exactly(2))
+ ->method('addHeader')
+ ->willReturn(null);
+ $this->configMock->expects($this->once())
+ ->method('getTokenUrl')
+ ->willReturn('http://www.some.url.com');
+ $this->configMock->expects($this->once())
+ ->method('getApiKey')
+ ->willReturn('string');
+ $this->configMock->expects($this->once())
+ ->method('getPrivateKey')
+ ->willReturn('string');
+ $curl->expects($this->once())
+ ->method('post')
+ ->willReturn(null);
+
+ $data = ['access_token' => 'string'];
+
+ $this->jsonMock->expects($this->once())
+ ->method('unserialize')
+ ->willReturn($data);
+ $tokenResponse = $this->createMock(TokenResponse::class);
+ $this->tokenResponseFactoryMock->expects($this->once())
+ ->method('create')
+ ->with(['data' => $data])
+ ->willReturn($tokenResponse);
+ $this->assertEquals($tokenResponse, $this->getToken->execute('code'));
+ }
+}
diff --git a/app/code/Magento/AdobeIms/Test/Unit/Model/LogOutTest.php b/app/code/Magento/AdobeIms/Test/Unit/Model/LogOutTest.php
new file mode 100644
index 0000000000000..fa6c7c1bcb9f1
--- /dev/null
+++ b/app/code/Magento/AdobeIms/Test/Unit/Model/LogOutTest.php
@@ -0,0 +1,172 @@
+curlFactoryMock = $this->createMock(CurlFactory::class);
+ $this->configInterfaceMock = $this->createMock(ConfigInterface::class);
+ $this->loggerInterfaceMock = $this->createMock(LoggerInterface::class);
+ $this->getToken = $this->createMock(GetAccessTokenInterface::class);
+ $this->flushTokens = $this->createMock(FlushUserTokensInterface::class);
+ $this->model = new LogOut(
+ $this->loggerInterfaceMock,
+ $this->configInterfaceMock,
+ $this->curlFactoryMock,
+ $this->getToken,
+ $this->flushTokens
+ );
+ }
+
+ /**
+ * Test LogOut.
+ */
+ public function testExecute(): void
+ {
+ $this->getToken->expects($this->once())
+ ->method('execute')
+ ->willReturn('token');
+
+ $curl = $this->createMock(Curl::class);
+ $this->curlFactoryMock->expects($this->once())
+ ->method('create')
+ ->willReturn($curl);
+ $curl->expects($this->exactly(2))
+ ->method('addHeader')
+ ->willReturn(null);
+ $curl->expects($this->once())
+ ->method('get')
+ ->willReturnSelf();
+ $curl->expects($this->once())
+ ->method('getStatus')
+ ->willReturn(self::HTTP_FOUND);
+
+ $this->flushTokens->expects($this->once())
+ ->method('execute');
+
+ $this->assertEquals(true, $this->model->execute());
+ }
+
+ /**
+ * Test LogOut with Error.
+ */
+ public function testExecuteWithError(): void
+ {
+ $this->getToken->expects($this->once())
+ ->method('execute')
+ ->willReturn('token');
+
+ $curl = $this->createMock(Curl::class);
+ $this->curlFactoryMock->expects($this->once())
+ ->method('create')
+ ->willReturn($curl);
+ $curl->expects($this->exactly(2))
+ ->method('addHeader')
+ ->willReturn(null);
+ $curl->expects($this->once())
+ ->method('get')
+ ->willReturnSelf();
+ $curl->expects($this->once())
+ ->method('getStatus')
+ ->willReturn(self::HTTP_ERROR);
+ $this->loggerInterfaceMock->expects($this->once())
+ ->method('critical');
+
+ $this->flushTokens->expects($this->never())
+ ->method('execute');
+
+ $this->assertEquals(false, $this->model->execute());
+ }
+
+ /**
+ * Test LogOut with Exception.
+ */
+ public function testExecuteWithException(): void
+ {
+ $this->getToken->expects($this->once())
+ ->method('execute')
+ ->willReturn('token');
+
+ $curl = $this->createMock(Curl::class);
+ $this->curlFactoryMock->expects($this->once())
+ ->method('create')
+ ->willReturn($curl);
+ $curl->expects($this->exactly(2))
+ ->method('addHeader')
+ ->willReturn(null);
+ $curl->expects($this->once())
+ ->method('get')
+ ->willReturnSelf();
+ $curl->expects($this->once())
+ ->method('getStatus')
+ ->willReturn(self::HTTP_FOUND);
+
+ $this->flushTokens->expects($this->once())
+ ->method('execute')
+ ->willThrowException(new Exception('Could not save user profile.'));
+ $this->loggerInterfaceMock->expects($this->once())
+ ->method('critical');
+ $this->assertFalse($this->model->execute());
+ }
+}
diff --git a/app/code/Magento/AdobeIms/Test/Unit/Model/UserAuthorizedTest.php b/app/code/Magento/AdobeIms/Test/Unit/Model/UserAuthorizedTest.php
new file mode 100644
index 0000000000000..a2c7efd6a6b6b
--- /dev/null
+++ b/app/code/Magento/AdobeIms/Test/Unit/Model/UserAuthorizedTest.php
@@ -0,0 +1,68 @@
+userContext = $this->createMock(UserContextInterface::class);
+ $this->userProfile = $this->createMock(UserProfileRepositoryInterface::class);
+ $this->userAuthorized = new UserAuthorized(
+ $this->userContext,
+ $this->userProfile
+ );
+ }
+
+ /**
+ * Ensure that user authorized or not
+ */
+ public function testExecute(): void
+ {
+ $this->userContext->expects($this->once())->method('getUserId')->willReturn(1);
+ $userProfileMock = $this->createMock(UserProfileInterface::class);
+ $this->userProfile->expects($this->exactly(1))
+ ->method('getByUserId')
+ ->willReturn($userProfileMock);
+ $userProfileMock->expects($this->once())->method('getId')->willReturn(1);
+ $userProfileMock->expects($this->once())->method('getAccessToken')->willReturn('token');
+ $userProfileMock->expects($this->exactly(2))
+ ->method('getAccessTokenExpiresAt')
+ ->willReturn(date('Y-m-d H:i:s'));
+
+ $this->assertTrue($this->userAuthorized->execute());
+ }
+}
diff --git a/app/code/Magento/AdobeIms/Test/Unit/Model/UserProfileRepositoryTest.php b/app/code/Magento/AdobeIms/Test/Unit/Model/UserProfileRepositoryTest.php
new file mode 100644
index 0000000000000..8ac45f9f44346
--- /dev/null
+++ b/app/code/Magento/AdobeIms/Test/Unit/Model/UserProfileRepositoryTest.php
@@ -0,0 +1,138 @@
+objectManager = new ObjectManager($this);
+ $this->resource = $this->createMock(ResourceUserProfile::class);
+ $this->entityFactory = $this->createMock(UserProfileInterfaceFactory::class);
+ $this->loggerMock = $this->createMock(LoggerInterface::class);
+ $this->model = new UserProfileRepository(
+ $this->resource,
+ $this->entityFactory,
+ $this->loggerMock
+ );
+ }
+
+ /**
+ * Test save.
+ */
+ public function testSave(): void
+ {
+ $userProfile = $this->objectManager->getObject(UserProfile::class);
+ $this->resource->expects($this->once())
+ ->method('save')
+ ->with($userProfile);
+ $this->model->save($userProfile);
+ }
+
+ /**
+ * Test save with exception.
+ */
+ public function testSaveWithException(): void
+ {
+ $this->expectException(CouldNotSaveException::class);
+ $this->expectExceptionMessage('Could not save user profile.');
+
+ $userProfile = $this->createMock(UserProfile::class);
+ $this->resource->expects($this->once())
+ ->method('save')
+ ->with($userProfile)
+ ->willThrowException(
+ new CouldNotSaveException(__('Could not save user profile.'))
+ );
+ $this->loggerMock->expects($this->once())->method('critical');
+ $this->model->save($userProfile);
+ }
+
+ /**
+ * Test get id.
+ */
+ public function testGet(): void
+ {
+ $entity = $this->objectManager->getObject(UserProfile::class)->setId(1);
+ $this->entityFactory->method('create')
+ ->willReturn($entity);
+ $this->assertEquals($this->model->get(1)->getId(), 1);
+ }
+
+ /**
+ * Test get user id with exception.
+ */
+ public function testGeWithException(): void
+ {
+ $this->expectException(NoSuchEntityException::class);
+ $this->expectExceptionMessage('The user profile wasn\'t found.');
+
+ $entity = $this->objectManager->getObject(UserProfile::class);
+ $this->entityFactory->method('create')
+ ->willReturn($entity);
+ $this->resource->expects($this->once())
+ ->method('load')
+ ->willThrowException(
+ new NoSuchEntityException(__('The user profile wasn\'t found.'))
+ );
+ $this->model->get(1);
+ }
+
+ /**
+ * Test get by user id.
+ */
+ public function testGetByUserId(): void
+ {
+ $entity = $this->objectManager->getObject(UserProfile::class)->setId(1);
+ $this->entityFactory->method('create')
+ ->willReturn($entity);
+ $this->assertEquals($this->model->getByUserId(1)->getId(), 1);
+ }
+}
diff --git a/app/code/Magento/AdobeIms/Test/Unit/Model/UserProfileTest.php b/app/code/Magento/AdobeIms/Test/Unit/Model/UserProfileTest.php
new file mode 100644
index 0000000000000..39d71de69606f
--- /dev/null
+++ b/app/code/Magento/AdobeIms/Test/Unit/Model/UserProfileTest.php
@@ -0,0 +1,151 @@
+objectManager = new ObjectManager($this);
+ $this->model = $this->objectManager->getObject(UserProfile::class);
+ }
+
+ /**
+ * Test setAccessToken
+ */
+ public function testAccessToken(): void
+ {
+ $value = 'value1';
+ $this->model->setAccessToken($value);
+ $this->assertSame($value, $this->model->getAccessToken());
+ }
+
+ /**
+ * Test setRefreshToken
+ */
+ public function testRefreshToken(): void
+ {
+ $value = 'value1';
+ $this->model->setRefreshToken($value);
+ $this->assertSame($value, $this->model->getRefreshToken());
+ }
+
+ /**
+ * Test setAccessTokenExpiresAt
+ */
+ public function testAccessTokenExpiresAt(): void
+ {
+ $value = 'value1';
+ $this->model->setAccessTokenExpiresAt($value);
+ $this->assertSame($value, $this->model->getAccessTokenExpiresAt());
+ }
+
+ /**
+ * Test setCreatedAt
+ */
+ public function testCreatedAt(): void
+ {
+ $value = 'value1';
+ $this->model->setCreatedAt($value);
+ $this->assertSame($value, $this->model->getCreatedAt());
+ }
+
+ /**
+ * Test setUpdatedAt
+ */
+ public function testUpdatedAt(): void
+ {
+ $value = 'value1';
+ $this->model->setUpdatedAt($value);
+ $this->assertSame($value, $this->model->getUpdatedAt());
+ }
+
+ /**
+ * Test setAccountType
+ */
+ public function testAccountType(): void
+ {
+ $value = 'value1';
+ $this->model->setAccountType($value);
+ $this->assertSame($value, $this->model->getAccountType());
+ }
+
+ /**
+ * Test setEmail
+ */
+ public function testEmail(): void
+ {
+ $value = 'value1';
+ $this->model->setEmail($value);
+ $this->assertSame($value, $this->model->getEmail());
+ }
+
+ /**
+ * Test setImage
+ */
+ public function testImage(): void
+ {
+ $value = 'value1';
+ $this->model->setImage($value);
+ $this->assertSame($value, $this->model->getImage());
+ }
+
+ /**
+ * Test setName
+ */
+ public function testName(): void
+ {
+ $value = 'value1';
+ $this->model->setName($value);
+ $this->assertSame($value, $this->model->getName());
+ }
+
+ /**
+ * Test setUserId
+ */
+ public function testUserId(): void
+ {
+ $value = 42;
+ $this->model->setUserId($value);
+ $this->assertSame($value, $this->model->getUserId());
+ }
+
+ /**
+ * Test setExtensionAttributes
+ */
+ public function testExtensionAttributes(): void
+ {
+ $value = $this->createMock(UserProfileExtensionInterface::class);
+ $this->model->setExtensionAttributes($value);
+ $this->assertSame($value, $this->model->getExtensionAttributes());
+ }
+}
diff --git a/app/code/Magento/AdobeIms/Test/Unit/Observer/FlushUsersTokensObserverTest.php b/app/code/Magento/AdobeIms/Test/Unit/Observer/FlushUsersTokensObserverTest.php
new file mode 100644
index 0000000000000..268222290c512
--- /dev/null
+++ b/app/code/Magento/AdobeIms/Test/Unit/Observer/FlushUsersTokensObserverTest.php
@@ -0,0 +1,58 @@
+flushUserTokens = $this->createMock(FlushUserTokens::class);
+ $helper = new ObjectManager($this);
+ $this->model = $helper->getObject(
+ FlushUsersTokensObserver::class,
+ [
+ 'flushUserTokens' => $this->flushUserTokens
+ ]
+ );
+ }
+
+ /**
+ * Test flush tokens observer
+ */
+ public function testFlushUsersTokensObserver(): void
+ {
+ /** @var Observer|MockObject $eventObserverMock */
+ $eventObserverMock = $this->createMock(Observer::class);
+ $requestMock = $this->createMock(RequestInterface::class);
+ $requestMock->expects($this->once())->method("getParam")->willReturn(["Magento_AnyModule::anything"]);
+ $roleMock = $this->createMock(Role::class);
+ $roleMock->expects($this->once())->method("getRoleUsers")->willReturn([1,2,3]);
+ $eventObserverMock->expects($this->exactly(2))->method("getDataByKey")
+ ->will($this->returnValueMap([["request", $requestMock],["object", $roleMock]]));
+ $this->flushUserTokens->expects($this->exactly(3))->method("execute")->willReturnSelf();
+ $this->model->execute($eventObserverMock);
+ }
+}
diff --git a/app/code/Magento/AdobeIms/composer.json b/app/code/Magento/AdobeIms/composer.json
new file mode 100644
index 0000000000000..872c29ffc97b4
--- /dev/null
+++ b/app/code/Magento/AdobeIms/composer.json
@@ -0,0 +1,26 @@
+{
+ "name": "magento/module-adobe-ims",
+ "description": "Magento module responsible for authentication to Adobe services",
+ "require": {
+ "php": "~7.4.0||~8.1.0",
+ "magento/framework": "*",
+ "magento/module-adobe-ims-api": "*",
+ "magento/module-authorization": "*",
+ "magento/module-backend": "*",
+ "magento/module-config": "*",
+ "magento/module-user": "*"
+ },
+ "type": "magento2-module",
+ "license": [
+ "OSL-3.0",
+ "AFL-3.0"
+ ],
+ "autoload": {
+ "files": [
+ "registration.php"
+ ],
+ "psr-4": {
+ "Magento\\AdobeIms\\": ""
+ }
+ }
+}
diff --git a/app/code/Magento/AdobeIms/etc/acl.xml b/app/code/Magento/AdobeIms/etc/acl.xml
new file mode 100644
index 0000000000000..f80868022a67a
--- /dev/null
+++ b/app/code/Magento/AdobeIms/etc/acl.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/AdobeIms/etc/adminhtml/events.xml b/app/code/Magento/AdobeIms/etc/adminhtml/events.xml
new file mode 100644
index 0000000000000..5f4caac410da3
--- /dev/null
+++ b/app/code/Magento/AdobeIms/etc/adminhtml/events.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
diff --git a/app/code/Magento/AdobeIms/etc/adminhtml/routes.xml b/app/code/Magento/AdobeIms/etc/adminhtml/routes.xml
new file mode 100644
index 0000000000000..30b4d3a98b3d8
--- /dev/null
+++ b/app/code/Magento/AdobeIms/etc/adminhtml/routes.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/AdobeIms/etc/config.xml b/app/code/Magento/AdobeIms/etc/config.xml
new file mode 100644
index 0000000000000..b6cbbb24e351a
--- /dev/null
+++ b/app/code/Magento/AdobeIms/etc/config.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+ https://ims-na1.adobelogin.com/ims/token
+
+
+
+
+
+
+
diff --git a/app/code/Magento/AdobeIms/etc/db_schema.xml b/app/code/Magento/AdobeIms/etc/db_schema.xml
new file mode 100644
index 0000000000000..b18a7738ef44e
--- /dev/null
+++ b/app/code/Magento/AdobeIms/etc/db_schema.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/AdobeIms/etc/db_schema_whitelist.json b/app/code/Magento/AdobeIms/etc/db_schema_whitelist.json
new file mode 100644
index 0000000000000..66e8ef6e59a06
--- /dev/null
+++ b/app/code/Magento/AdobeIms/etc/db_schema_whitelist.json
@@ -0,0 +1,23 @@
+{
+ "adobe_user_profile": {
+ "column": {
+ "id": true,
+ "admin_user_id": true,
+ "name": true,
+ "email": true,
+ "image": true,
+ "account_type": true,
+ "access_token": true,
+ "refresh_token": true,
+ "created_at": true,
+ "updated_at": true
+ },
+ "index": {
+ "ADOBE_USER_PROFILE_ID": true
+ },
+ "constraint": {
+ "PRIMARY": true,
+ "ADOBE_USER_PROFILE_ADMIN_USER_ID_ADMIN_USER_USER_ID": true
+ }
+ }
+}
diff --git a/app/code/Magento/AdobeIms/etc/di.xml b/app/code/Magento/AdobeIms/etc/di.xml
new file mode 100644
index 0000000000000..5d6f2accaea3d
--- /dev/null
+++ b/app/code/Magento/AdobeIms/etc/di.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/AdobeIms/etc/module.xml b/app/code/Magento/AdobeIms/etc/module.xml
new file mode 100644
index 0000000000000..b19b836ba9895
--- /dev/null
+++ b/app/code/Magento/AdobeIms/etc/module.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
diff --git a/app/code/Magento/AdobeIms/i18n/en_US.csv b/app/code/Magento/AdobeIms/i18n/en_US.csv
new file mode 100644
index 0000000000000..f3fd3362ad9c8
--- /dev/null
+++ b/app/code/Magento/AdobeIms/i18n/en_US.csv
@@ -0,0 +1,17 @@
+"Authorization was successful","Authorization was successful"
+"Something went wrong.","Something went wrong."
+"An error occurred during the callback request from the Adobe service: %error","An error occurred during the callback request from the Adobe service: %error"
+"An error occurred during get user data. Contact support.","An error occurred during get user data. Contact support."
+"The response is empty.","The response is empty."
+"Login failed. Please check if the Secret Key is set correctly and try again.","Login failed. Please check if the Secret Key is set correctly and try again."
+"An error occurred during logout operation.","An error occurred during logout operation."
+"An error occurred during user profile save: %error","An error occurred during user profile save: %error"
+"User profile with id %id not found.","User profile with id %id not found."
+"User profile with user id %id not found.","User profile with user id %id not found."
+"Could not save user profile.","Could not save user profile."
+"The user profile wasn't found.","The user profile wasn't found."
+"Adobe IMS","Adobe IMS"
+Actions,Actions
+Login,Login
+Logout,Logout
+"Get User Profile","Get User Profile"
diff --git a/app/code/Magento/AdobeIms/registration.php b/app/code/Magento/AdobeIms/registration.php
new file mode 100644
index 0000000000000..bdf7285872200
--- /dev/null
+++ b/app/code/Magento/AdobeIms/registration.php
@@ -0,0 +1,10 @@
+
+
+
+
+
diff --git a/app/code/Magento/AdobeIms/view/adminhtml/web/css/source/_module.less b/app/code/Magento/AdobeIms/view/adminhtml/web/css/source/_module.less
new file mode 100644
index 0000000000000..07c0ab8951b35
--- /dev/null
+++ b/app/code/Magento/AdobeIms/view/adminhtml/web/css/source/_module.less
@@ -0,0 +1,86 @@
+// /**
+// * Copyright © Magento, Inc. All rights reserved.
+// * See COPYING.txt for license details.
+// */
+
+//
+// Variables
+// _____________________________________________
+
+@color-sign-in-button-hover-active: #007bdb;
+
+
+& when (@media-common = true) {
+ .adobe-login-container {
+ .adobe-sign-in-button {
+ background: transparent;
+ border: none;
+ box-shadow: none;
+ float: right;
+ margin-right: 3%;
+ margin-top: -50px;
+ position: relative;
+ z-index: 99;
+
+ &:hover:active {
+ background: transparent;
+ color: @color-sign-in-button-hover-active;
+ }
+ }
+
+ .adobe-user-information {
+ float: right;
+ margin-right: 30px;
+ margin-top: -54px;
+ width: auto;
+
+ .adobe-profile-image-small {
+ background-repeat: repeat-x;
+ border-radius: 50%;
+ margin-bottom: -14px;
+ width: 40px;
+ }
+
+ .adobe-user-name {
+ border: 0;
+ box-shadow: none;
+ padding-left: 10px;
+ }
+
+ .adobe-user-popup {
+ min-width: 10px;
+ padding-left: 20px;
+ width: 320px;
+ z-index: 282;
+
+ .adobe-profile-image-large {
+ float: left;
+ padding-right: 10px;
+ padding-top: 5px;
+ width: 30%;
+ }
+
+ ul {
+ list-style: none;
+
+ li {
+ padding-bottom: 5px;
+ }
+ }
+
+ .adobe-sign-out-button {
+ background: transparent;
+ border: none;
+ float: left;
+ margin-top: 20px;
+ padding-bottom: 20px;
+ padding-left: 0;
+
+ &:hover {
+ background: transparent;
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/app/code/Magento/AdobeIms/view/adminhtml/web/js/action/authorization.js b/app/code/Magento/AdobeIms/view/adminhtml/web/js/action/authorization.js
new file mode 100644
index 0000000000000..53386decafa9e
--- /dev/null
+++ b/app/code/Magento/AdobeIms/view/adminhtml/web/js/action/authorization.js
@@ -0,0 +1,132 @@
+/**
+ * Copyright © Magento, Inc. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+define([
+ 'jquery'
+], function ($) {
+ 'use strict';
+
+ /**
+ * Build window params
+ * @param {Object} windowParams
+ * @returns {String}
+ */
+ function buildWindowParams(windowParams) {
+ var output = '',
+ coma = '',
+ paramName,
+ paramValue;
+
+ for (paramName in windowParams) {
+ if (windowParams[paramName]) {
+ paramValue = windowParams[paramName];
+ output += coma + paramName + '=' + paramValue;
+ coma = ',';
+ }
+ }
+
+ return output;
+ }
+
+ return function (config) {
+ var authWindow,
+ deferred = $.Deferred(),
+ watcherId,
+ stopWatcherId;
+
+ /**
+ * Close authorization window if already opened
+ */
+ if (window.adobeIMSAuthWindow) {
+ window.adobeIMSAuthWindow.close();
+ }
+
+ /**
+ * Opens authorization window with special parameters
+ */
+ authWindow = window.adobeIMSAuthWindow = window.open(
+ config.url,
+ 'authorization_widnow',
+ buildWindowParams(
+ config.popupWindowParams || {
+ width: 500,
+ height: 300
+ }
+ )
+ );
+
+ /**
+ * Stop handle
+ */
+ function stopHandle() {
+ // Clear timers
+ clearTimeout(stopWatcherId);
+ clearInterval(watcherId);
+
+ // Close window
+ authWindow.close();
+ }
+
+ /**
+ * Start handle
+ */
+ function startHandle() {
+ var responseData;
+
+ try {
+
+ if (authWindow.document.domain !== document.domain ||
+ authWindow.document.readyState !== 'complete') {
+ return;
+ }
+
+ /**
+ * If within 10 seconds the result is not received, then reject the request
+ */
+ stopWatcherId = setTimeout(function () {
+ stopHandle();
+ deferred.reject(new Error('Time\'s up.'));
+ }, config.popupWindowTimeout || 60000);
+
+ responseData = authWindow.document.body.innerHTML.match(
+ config.callbackParsingParams.regexpPattern
+ );
+
+ if (!responseData) {
+ return;
+ }
+
+ stopHandle();
+
+ if (responseData[config.callbackParsingParams.codeIndex] ===
+ config.callbackParsingParams.successCode) {
+ deferred.resolve({
+ isAuthorized: true,
+ lastAuthSuccessMessage: responseData[config.callbackParsingParams.messageIndex]
+ });
+ } else {
+ deferred.reject(responseData[config.callbackParsingParams.messageIndex]);
+ }
+ } catch (e) {
+ if (authWindow.closed) {
+ clearTimeout(stopWatcherId);
+ clearInterval(watcherId);
+
+ // eslint-disable-next-line max-depth
+ if (window.adobeIMSAuthWindow && window.adobeIMSAuthWindow.closed) {
+ deferred.reject(new Error('Authentication window was closed.'));
+ }
+ }
+ }
+ }
+
+ /**
+ * Watch a result 1 time per second
+ */
+ watcherId = setInterval(startHandle, 1000);
+
+ return deferred.promise();
+ };
+});
diff --git a/app/code/Magento/AdobeIms/view/adminhtml/web/js/config.js b/app/code/Magento/AdobeIms/view/adminhtml/web/js/config.js
new file mode 100644
index 0000000000000..ed6c1b7c8a9cc
--- /dev/null
+++ b/app/code/Magento/AdobeIms/view/adminhtml/web/js/config.js
@@ -0,0 +1,32 @@
+/**
+ * Copyright © Magento, Inc. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+define([], function () {
+ 'use strict';
+
+ return {
+ loginUrl: 'https://ims-na1.adobelogin.com/ims/authorize',
+ profileUrl: 'adobe_ims/user/profile',
+ logoutUrl: 'adobe_ims/user/logout',
+ manageAccountLink: 'https://account.adobe.com/',
+ login: {
+ callbackParsingParams: {
+ regexpPattern: /auth\[code=(success|error);message=(.+)\]/,
+ codeIndex: 1,
+ messageIndex: 2,
+ nameIndex: 3,
+ successCode: 'success',
+ errorCode: 'error'
+ },
+ popupWindowParams: {
+ width: 500,
+ height: 600,
+ top: 100,
+ left: 300
+ },
+ popupWindowTimeout: 10000
+ }
+ };
+});
+
diff --git a/app/code/Magento/AdobeIms/view/adminhtml/web/js/signIn.js b/app/code/Magento/AdobeIms/view/adminhtml/web/js/signIn.js
new file mode 100644
index 0000000000000..2c2cabe3ab4e3
--- /dev/null
+++ b/app/code/Magento/AdobeIms/view/adminhtml/web/js/signIn.js
@@ -0,0 +1,143 @@
+/**
+ * Copyright © Magento, Inc. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+define([
+ 'uiComponent',
+ 'jquery',
+ 'Magento_AdobeIms/js/action/authorization'
+], function (Component, $, login) {
+ 'use strict';
+
+ return Component.extend({
+
+ defaults: {
+ profileUrl: 'adobe_ims/user/profile',
+ logoutUrl: 'adobe_ims/user/logout',
+ user: {
+ isAuthorized: false,
+ name: '',
+ email: '',
+ image: ''
+ },
+ loginConfig: {
+ url: 'https://ims-na1.adobelogin.com/ims/authorize',
+ callbackParsingParams: {
+ regexpPattern: /auth\[code=(success|error);message=(.+)\]/,
+ codeIndex: 1,
+ messageIndex: 2,
+ nameIndex: 3,
+ successCode: 'success',
+ errorCode: 'error'
+ },
+ popupWindowParams: {
+ width: 500,
+ height: 600,
+ top: 100,
+ left: 300
+ },
+ popupWindowTimeout: 60000
+ }
+ },
+
+ /**
+ * @inheritdoc
+ */
+ initObservable: function () {
+ this._super().observe(['user']);
+
+ return this;
+ },
+
+ /**
+ * Login to Adobe
+ *
+ * @return {window.Promise}
+ */
+ login: function () {
+ var deferred = $.Deferred();
+
+ if (this.user().isAuthorized) {
+ deferred.resolve();
+ }
+ login(this.loginConfig)
+ .then(function (response) {
+ this.loadUserProfile();
+ deferred.resolve(response);
+ }.bind(this))
+ .fail(function (error) {
+ deferred.reject(error);
+ });
+
+ return deferred.promise();
+ },
+
+ /**
+ * Retrieve data to authorized user.
+ *
+ * @return array
+ */
+ loadUserProfile: function () {
+ $.ajax({
+ type: 'GET',
+ url: this.profileUrl,
+ showLoader: true,
+ dataType: 'json',
+ context: this,
+
+ /**
+ * @param {Object} response
+ * @returns void
+ */
+ success: function (response) {
+ this.user({
+ isAuthorized: true,
+ name: response.result.name,
+ email: response.result.email,
+ image: response.result.image
+ });
+ },
+
+ /**
+ * @param {Object} response
+ * @returns {String}
+ */
+ error: function (response) {
+ return response.message;
+ }
+ });
+ },
+
+ /**
+ * Logout from adobe account
+ */
+ logout: function () {
+ $.ajax({
+ type: 'POST',
+ url: this.logoutUrl,
+ data: {
+ 'form_key': window.FORM_KEY
+ },
+ dataType: 'json',
+ context: this,
+ showLoader: true,
+ success: function () {
+ this.user({
+ isAuthorized: false,
+ name: '',
+ email: '',
+ image: ''
+ });
+ }.bind(this),
+
+ /**
+ * @param {Object} response
+ * @returns {String}
+ */
+ error: function (response) {
+ return response.message;
+ }
+ });
+ }
+ });
+});
diff --git a/app/code/Magento/AdobeIms/view/adminhtml/web/js/user.js b/app/code/Magento/AdobeIms/view/adminhtml/web/js/user.js
new file mode 100644
index 0000000000000..7a403e14baa6e
--- /dev/null
+++ b/app/code/Magento/AdobeIms/view/adminhtml/web/js/user.js
@@ -0,0 +1,13 @@
+/**
+ * Copyright © Magento, Inc. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+define(['ko'], function (ko) {
+ 'use strict';
+
+ return {
+ isAuthorized: ko.observable(false),
+ name: ko.observable(''),
+ email: ko.observable('')
+ };
+});
diff --git a/app/code/Magento/AdobeIms/view/adminhtml/web/template/signIn.html b/app/code/Magento/AdobeIms/view/adminhtml/web/template/signIn.html
new file mode 100644
index 0000000000000..dae814b30718f
--- /dev/null
+++ b/app/code/Magento/AdobeIms/view/adminhtml/web/template/signIn.html
@@ -0,0 +1,50 @@
+
+
+ Sign In
+
+
diff --git a/app/code/Magento/AdobeImsApi/Api/ConfigInterface.php b/app/code/Magento/AdobeImsApi/Api/ConfigInterface.php
new file mode 100644
index 0000000000000..93284fee8e066
--- /dev/null
+++ b/app/code/Magento/AdobeImsApi/Api/ConfigInterface.php
@@ -0,0 +1,68 @@
+" or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process.
\ No newline at end of file
diff --git a/app/code/Magento/AdobeImsApi/LICENSE_AFL.txt b/app/code/Magento/AdobeImsApi/LICENSE_AFL.txt
new file mode 100644
index 0000000000000..f39d641b18a19
--- /dev/null
+++ b/app/code/Magento/AdobeImsApi/LICENSE_AFL.txt
@@ -0,0 +1,48 @@
+
+Academic Free License ("AFL") v. 3.0
+
+This Academic Free License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work:
+
+Licensed under the Academic Free License version 3.0
+
+ 1. Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following:
+
+ 1. to reproduce the Original Work in copies, either alone or as part of a collective work;
+
+ 2. to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work;
+
+ 3. to distribute or communicate copies of the Original Work and Derivative Works to the public, under any license of your choice that does not contradict the terms and conditions, including Licensor's reserved rights and remedies, in this Academic Free License;
+
+ 4. to perform the Original Work publicly; and
+
+ 5. to display the Original Work publicly.
+
+ 2. Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works.
+
+ 3. Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work.
+
+ 4. Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor's trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license.
+
+ 5. External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c).
+
+ 6. Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work.
+
+ 7. Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer.
+
+ 8. Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation.
+
+ 9. Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including "fair use" or "fair dealing"). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c).
+
+ 10. Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware.
+
+ 11. Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License.
+
+ 12. Attorneys' Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License.
+
+ 13. Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable.
+
+ 14. Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+ 15. Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You.
+
+ 16. Modification of This License. This License is Copyright © 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Academic Free License" or "AFL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under " or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process.
diff --git a/app/code/Magento/AdobeImsApi/README.md b/app/code/Magento/AdobeImsApi/README.md
new file mode 100644
index 0000000000000..49442a872f7df
--- /dev/null
+++ b/app/code/Magento/AdobeImsApi/README.md
@@ -0,0 +1,13 @@
+# Magento_AdobeImsApi module
+
+The Magento_AdobeImsApi module serves as application program interface (API) responsible for authentication to Adobe services.
+
+## Extensibility
+
+Extension developers can interact with the Magento_AdobeImsApi module. For more information about the Magento extension mechanism, see [Magento plug-ins](https://devdocs.magento.com/guides/v2.4/extension-dev-guide/plugins.html).
+
+[The Magento dependency injection mechanism](https://devdocs.magento.com/guides/v2.4/extension-dev-guide/depend-inj.html) enables you to override the functionality of the Magento_AdobeImsApi module.
+
+## Additional information
+
+For information about significant changes in patch releases, see [2.4.x Release information](https://devdocs.magento.com/guides/v2.4/release-notes/bk-release-notes.html).
diff --git a/app/code/Magento/AdobeImsApi/composer.json b/app/code/Magento/AdobeImsApi/composer.json
new file mode 100644
index 0000000000000..231f1ddfa1513
--- /dev/null
+++ b/app/code/Magento/AdobeImsApi/composer.json
@@ -0,0 +1,21 @@
+{
+ "name": "magento/module-adobe-ims-api",
+ "description": "Implementation of Magento module responsible for authentication to Adobe services",
+ "require": {
+ "php": "~7.4.0||~8.1.0",
+ "magento/framework": "*"
+ },
+ "type": "magento2-module",
+ "license": [
+ "OSL-3.0",
+ "AFL-3.0"
+ ],
+ "autoload": {
+ "files": [
+ "registration.php"
+ ],
+ "psr-4": {
+ "Magento\\AdobeImsApi\\": ""
+ }
+ }
+}
diff --git a/app/code/Magento/AdobeImsApi/etc/module.xml b/app/code/Magento/AdobeImsApi/etc/module.xml
new file mode 100644
index 0000000000000..2ec4c518b9ec8
--- /dev/null
+++ b/app/code/Magento/AdobeImsApi/etc/module.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
diff --git a/app/code/Magento/AdobeImsApi/registration.php b/app/code/Magento/AdobeImsApi/registration.php
new file mode 100644
index 0000000000000..af0df625f4321
--- /dev/null
+++ b/app/code/Magento/AdobeImsApi/registration.php
@@ -0,0 +1,10 @@
+