Skip to content

Commit f9adcd9

Browse files
authored
Merge pull request #7800 from magento-gl/2.4.5-develop-sync
2.4.5 develop sync
2 parents 2854866 + 09a1d8f commit f9adcd9

File tree

113 files changed

+1795
-828
lines changed

Some content is hidden

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

113 files changed

+1795
-828
lines changed

app/code/Magento/AdminAdobeIms/Service/ImsConfig.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class ImsConfig extends Config
2929
public const XML_PATH_PROFILE_URL = 'adobe_ims/integration/profile_url';
3030
public const XML_PATH_NEW_ADMIN_EMAIL_TEMPLATE = 'adobe_ims/email/content_template';
3131
public const XML_PATH_VALIDATE_TOKEN_URL = 'adobe_ims/integration/validate_token_url';
32-
public const XML_PATH_LOGOUT_URL = 'adobe_ims/integration/logout_url';
32+
public const XML_PATH_ADMIN_LOGOUT_URL = 'adobe_ims/integration/admin_logout_url';
3333
public const XML_PATH_CERTIFICATE_PATH = 'adobe_ims/integration/certificate_path';
3434
public const XML_PATH_ADMIN_AUTH_URL_PATTERN = 'adobe_ims/integration/admin/auth_url_pattern';
3535
public const XML_PATH_ADMIN_REAUTH_URL_PATTERN = 'adobe_ims/integration/admin/reauth_url_pattern';
@@ -353,7 +353,7 @@ public function getBackendLogoutUrl(string $accessToken) : string
353353
return str_replace(
354354
['#{access_token}', '#{client_secret}', '#{client_id}'],
355355
[$accessToken, $this->getPrivateKey(), $this->getApiKey()],
356-
$this->scopeConfig->getValue(self::XML_PATH_LOGOUT_URL)
356+
$this->scopeConfig->getValue(self::XML_PATH_ADMIN_LOGOUT_URL)
357357
);
358358
}
359359

app/code/Magento/AdminAdobeIms/Test/Mftf/ActionGroup/AdminAdobeImsSignInActionGroup.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<click selector="{{AdminAdobeImsSignInSection.AdobeImsUsernameContinueButton}}" stepKey="clickUsernameContinue"/>
2525

2626
<click selector="{{AdminAdobeImsSignInSection.AdobeImsProfileSelect}}" stepKey="clickProfile"/>
27-
27+
<wait time="10" stepKey="waitTenSeconds"/>
2828
<fillField selector="{{AdminAdobeImsSignInSection.password}}" userInput="{{password}}" stepKey="fillPassword"/>
2929
<click selector="{{AdminAdobeImsSignInSection.AdobeImsPasswordContinueButton}}" stepKey="clickPasswordContinue"/>
3030
<waitForPageLoad stepKey="waitForLoginToFinish"/>

app/code/Magento/AdminAdobeIms/Test/Mftf/ActionGroup/AdminCreateUserWithoutPasswordActionGroup.xml

+29-10
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,38 @@
1515
<arguments>
1616
<argument name="role"/>
1717
<argument name="user" defaultValue="newAdmin"/>
18+
<argument name="password" type="string" defaultValue="{{_ENV.ADOBE_IMS_PASSWORD}}"/>
1819
</arguments>
1920

20-
<amOnPage url="{{AdminNewUserPage.url}}" stepKey="navigateToNewUser"/>
21-
<waitForPageLoad stepKey="waitForUsersPage"/>
22-
<fillField selector="{{AdminCreateUserSection.usernameTextField}}" userInput="{{user.username}}" stepKey="enterUserName"/>
23-
<fillField selector="{{AdminCreateUserSection.firstNameTextField}}" userInput="{{user.firstName}}" stepKey="enterFirstName"/>
24-
<fillField selector="{{AdminCreateUserSection.lastNameTextField}}" userInput="{{user.lastName}}" stepKey="enterLastName"/>
25-
<fillField selector="{{AdminCreateUserSection.emailTextField}}" userInput="{{user.username}}@magento.com" stepKey="enterEmail"/>
26-
<scrollToTopOfPage stepKey="scrollToTopOfPage"/>
27-
<click stepKey="clickUserRole" selector="{{AdminCreateUserSection.userRoleTab}}"/>
28-
<click stepKey="chooseRole" selector="{{AdminStoreSection.createdRoleInUserPage(role.name)}}"/>
21+
<!--Open New Admin User Page. -->
22+
<amOnPage url="{{AdminNewUserPage.url}}" stepKey="navigateToNewAdminUser"/>
23+
<waitForPageLoad stepKey="waitForNewAdminUserPage"/>
24+
25+
<!-- Fill admin user data. -->
26+
<fillField selector="{{AdminCreateUserSection.usernameTextField}}" userInput="{{user.username}}" stepKey="enterAdminUserName"/>
27+
<fillField selector="{{AdminCreateUserSection.firstNameTextField}}" userInput="{{user.firstName}}" stepKey="enterAdminFirstName"/>
28+
<fillField selector="{{AdminCreateUserSection.lastNameTextField}}" userInput="{{user.lastName}}" stepKey="enterAdminLastName"/>
29+
<fillField selector="{{AdminCreateUserSection.emailTextField}}" userInput="{{user.username}}@magento.com" stepKey="enterAdminEmail"/>
30+
31+
<!-- Verify Current Admin User Identity via Adobe IMS. -->
32+
<click selector="{{AdminCreateUserSection.confirmIdentity}}" stepKey="clickConfirmIdentity"/>
33+
34+
<!-- Switch to Admin IMS Window. -->
35+
<switchToNextTab stepKey="switchToNextTab"/>
36+
<waitForElementVisible selector="{{AdminAdobeImsSignInSection.password}}" stepKey="waitForAdobeImsForm"/>
37+
<fillField selector="{{AdminCreateUserSection.password}}" userInput="{{password}}" stepKey="fillPassword"/>
38+
<click selector="{{AdminAdobeImsSignInSection.AdobeImsPasswordContinueButton}}" stepKey="clickPasswordContinue"/>
39+
<waitForElementNotVisible selector="{{AdminAdobeImsSignInSection.password}}" time="30" stepKey="waitForAdobeImsFormToDisappear"/>
40+
41+
<!-- Switch to Adobe Commerce Window. -->
42+
<switchToPreviousTab userInput="1" stepKey="switchPreviousTab"/>
43+
44+
<!-- Select Admin User Role. -->
45+
<click selector="{{AdminCreateUserSection.userRoleTab}}" stepKey="clickUserRole"/>
46+
<click selector="{{AdminStoreSection.createdRoleInUserPage(role.name)}}" stepKey="chooseRole"/>
47+
48+
<!-- Save admin user. -->
2949
<click selector="{{AdminCreateUserSection.saveButton}}" stepKey="clickSaveUser"/>
3050
<waitForPageLoad stepKey="waitForSaveTheUser"/>
31-
<see userInput="You saved the user." stepKey="seeSuccessMessage"/>
3251
</actionGroup>
3352
</actionGroups>

app/code/Magento/AdminAdobeIms/Test/Mftf/ActionGroup/AdminDisableAdobeImsActionGroup.xml

-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,5 @@
1414
</annotations>
1515

1616
<magentoCLI command="admin:adobe-ims:disable" stepKey="disableAdminAdobeImsModule"/>
17-
<magentoCLI command="cache:clean config full_page" stepKey="cleanInvalidatedCaches1"/>
1817
</actionGroup>
1918
</actionGroups>

app/code/Magento/AdminAdobeIms/Test/Mftf/ActionGroup/AdminEnableAdobeImsActionGroup.xml

-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,5 @@
1414
</annotations>
1515

1616
<magentoCLI command="admin:adobe-ims:enable -o {{ClientCredentialsData.org_id}} -c {{ClientCredentialsData.client_id}} -s {{ClientCredentialsData.client_key}} -t yes" stepKey="enableAdminAdobeImsModule" />
17-
<magentoCLI command="cache:clean config full_page" stepKey="cleanInvalidatedCaches1"/>
1817
</actionGroup>
1918
</actionGroups>

app/code/Magento/AdminAdobeIms/Test/Mftf/Section/AdminAdobeImsSignInSection.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
<section name="AdminAdobeImsSignInSection">
1212
<element name="username" type="input" selector="#EmailPage-EmailField"/>
1313
<element name="password" type="input" selector="#PasswordPage-PasswordField"/>
14-
<element name="AdminAdobeImsSignInButton" type="button" selector=".adobe-ims-button button" timeout="30"/>
15-
<element name="AdobeImsUsernameContinueButton" type="button" selector="//button[@data-id='EmailPage-ContinueButton']" timeout="30"/>
14+
<element name="AdminAdobeImsSignInButton" type="button" selector=".adobe-ims-button button" timeout="15"/>
15+
<element name="AdobeImsUsernameContinueButton" type="button" selector="//button[@data-id='EmailPage-ContinueButton']" timeout="15"/>
1616
<element name="AdobeImsPasswordContinueButton" type="button" selector="//button[@data-id='PasswordPage-ContinueButton']"/>
17-
<element name="AdobeImsProfileSelect" type="text" selector="//div[contains(text(),'Personal Account')]" timeout="30"/>
17+
<element name="AdobeImsProfileSelect" type="text" selector="//div[contains(text(),'Personal Account')]" timeout="15"/>
1818
</section>
1919
</sections>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="AdminCreateUserSection">
12+
<element name="confirmIdentity" type="button" selector="#user_ims_verification"/>
13+
<element name="password" type="input" selector="#PasswordPage-PasswordField"/>
14+
</section>
15+
</sections>

app/code/Magento/AdminAdobeIms/Test/Mftf/Test/CreateNewUserWithoutPasswordTest.xml renamed to app/code/Magento/AdminAdobeIms/Test/Mftf/Test/AdminCreateNewAdminUserWithAdobeImsTest.xml

+7-5
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@
77
-->
88
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
99
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10-
<test name="CreateNewUserWithoutPasswordTest">
10+
<test name="AdminCreateNewAdminUserWithAdobeImsTest">
1111
<annotations>
1212
<features value="Backend"/>
13-
<stories value="Create a new admin user without password"/>
14-
<title value="Create a new admin user without password"/>
15-
<description value="Create a new admin user without password when AdminAdobeImsModule is enabled"/>
13+
<stories value="Create a new admin user with enabled Adobe IMS integration"/>
14+
<title value="Create a new admin user with enabled Adobe IMS integration"/>
15+
<description value="Create a new admin user when AdminAdobeImsModule is enabled"/>
1616
<severity value="CRITICAL"/>
1717
<group value="admin_ims"/>
18+
<testCaseId value="CABPI-227"/>
1819
<skip>
1920
<issueId value="AC-3153">Skipped</issueId>
2021
</skip>
21-
<testCaseId value="CABPI-227"/>
2222
</annotations>
2323
<before>
2424
<actionGroup ref="AdminEnableAdobeImsActionGroup" stepKey="enableAdminAdobeImsModule" />
@@ -33,5 +33,7 @@
3333
<argument name="user" value="activeAdmin"/>
3434
<argument name="role" value="roleDefaultAdministrator"/>
3535
</actionGroup>
36+
37+
<see userInput="You saved the user." stepKey="seeSuccessMessage"/>
3638
</test>
3739
</tests>

app/code/Magento/AdminAdobeIms/Test/Mftf/Test/CallbackWithoutCodeRedirectsToAdminLoginTest.xml

+3-2
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,16 @@
2222
</annotations>
2323
<before>
2424
<actionGroup ref="AdminEnableAdobeImsActionGroup" stepKey="enableIms" />
25-
<amOnPage url="{{AdminAdobeImsCallbackPage.url}}" stepKey="openCallbackUrl"/>
2625
</before>
2726
<after>
2827
<actionGroup ref="AdminDisableAdobeImsActionGroup" stepKey="disableAdminAdobeImsModule" />
2928
</after>
3029

30+
<!-- Open admin login page using callback URL with no code -->
31+
<amOnPage url="{{AdminAdobeImsCallbackPage.url}}" stepKey="openCallbackUrl"/>
3132
<waitForPageLoad stepKey="waitForAdminLoginPageLoad"/>
3233

33-
<!-- Check for Sign in with error message -->
34+
<!-- Check for the error message on login page -->
3435
<actionGroup ref="AssertAdminSignInEmptyCodeErrorMessageTestActionGroup"
3536
stepKey="assertAdminLoginShowsErrorMessage"/>
3637
</test>

app/code/Magento/AdminAdobeIms/etc/config.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<token_url>https://ims-na1.adobelogin.com/ims/token</token_url>
2828
<profile_url><![CDATA[https://ims-na1.adobelogin.com/ims/profile/v1?client_id=#{client_id}]]></profile_url>
2929
<organization_membership_url><![CDATA[https://graph.identity.adobe.com/#{org_id}@AdobeOrg/membership]]></organization_membership_url>
30-
<logout_url><![CDATA[https://ims-na1.adobelogin.com/ims/logout/v1?access_token=#{access_token}&amp;client_id=#{client_id}&amp;client_secret=#{client_secret}]]></logout_url>
30+
<admin_logout_url><![CDATA[https://ims-na1.adobelogin.com/ims/logout/v1?access_token=#{access_token}&client_id=#{client_id}&client_secret=#{client_secret}]]></admin_logout_url>
3131
<certificate_path><![CDATA[https://static.adobelogin.com/keys/prod/]]></certificate_path>
3232
<validate_token_url><![CDATA[https://ims-na1.adobelogin.com/ims/validate_token/v1?token=#{token}&client_id=#{client_id}&type=#{token_type}]]></validate_token_url>
3333
</integration>

app/code/Magento/AdobeIms/Model/Config.php

+4
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ private function getLocale(): string
108108
*/
109109
public function getLogoutUrl(string $accessToken, string $redirectUrl = '') : string
110110
{
111+
// there is no success response with empty redirect url
112+
if ($redirectUrl === '') {
113+
$redirectUrl = 'self';
114+
}
111115
return str_replace(
112116
['#{access_token}', '#{redirect_uri}'],
113117
[$accessToken, $redirectUrl],

app/code/Magento/AdobeIms/Model/GetAccessToken.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ public function execute(int $adminUserId = null): ?string
5555
{
5656
try {
5757
$adminUserId = $adminUserId ?? (int) $this->userContext->getUserId();
58-
return $this->userProfileRepository->getByUserId($adminUserId)->getAccessToken();
58+
return $this->encryptor->decrypt(
59+
$this->userProfileRepository->getByUserId($adminUserId)->getAccessToken()
60+
);
5961
} catch (NoSuchEntityException $exception) {
6062
return null;
6163
}

app/code/Magento/AdobeIms/Test/Unit/Model/GetAccessTokenTest.php

+7
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ public function testExecute(?string $token): void
7272
->willReturn($userProfileMock);
7373
$userProfileMock->expects($this->once())->method('getAccessToken')->willReturn($token);
7474

75+
$decryptedToken = $token ?? '';
76+
77+
$this->encryptor->expects($this->once())
78+
->method('decrypt')
79+
->with($token)
80+
->willReturn($decryptedToken);
81+
7582
$this->assertEquals($token, $this->getAccessToken->execute());
7683
}
7784

0 commit comments

Comments
 (0)