You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: app/code/Magento/AdminAdobeIms/README.md
+21-27Lines changed: 21 additions & 27 deletions
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,12 @@
1
1
# Magento_Admin_Adobe_Ims module
2
-
3
2
The Magento_Admin_Adobe_Ims module contains integration with Adobe IMS for backend authentication.
4
3
5
4
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).
6
5
7
6
# CLI command usage:
8
7
## bin/magento admin:adobe-ims:enable
9
8
Enables the AdminAdobeIMS Module. \
10
-
Required values are `Organization ID`, `Client ID` and `Client Secret`
9
+
Required values are `Organization ID`, `Client ID`, `Client Secret` and `2FA enabled`
11
10
12
11
### Argument Validation
13
12
On enabling the AdminAdobeIMS Module, the input arguments will be validated. \
@@ -19,6 +18,7 @@ The pattern for the validation are configured in the di.xml
@@ -27,6 +27,7 @@ We check if the arguments are not empty, as they are all required.
27
27
28
28
For the Organization ID, Client ID and Client Secret, we check if they contain only alphanumeric characters. \
29
29
Additionally for the Organization ID, we check if it matches 24 characters and optional has the suffix `@AdobeOrg`. But we only store the ID and ignore the suffix.
30
+
Also make sure 2FA is enabled for the Organization in Adobe Admin Console.
30
31
31
32
## bin/magento admin:adobe-ims:disable
32
33
Disables the AdminAdobeIMS Module.
@@ -44,7 +45,6 @@ Client Secret configured
44
45
If Admin Adobe Ims module is disabled, cli command will show message "Module is disabled"
45
46
46
47
# Admin Login design
47
-
48
48
The admin login design changes when the AdminAdobeIms module is enabled and configured correctly via the CLI command.
49
49
We have added the customer layout handle `adobe_ims_login` to deal with all the design changes.
50
50
This handle is added via `\Magento\AdminAdobeIms\Plugin\AddAdobeImsLayoutHandlePlugin::afterAddDefaultHandle`.
@@ -59,24 +59,21 @@ We have included the minified css and the used svgs from Spectrum CSS with our m
59
59
To rebuild the minified css run the command `./node_modules/.bin/postcss -o dist/index.min.css index.css` after npm install from inside the web directory.
60
60
61
61
# AdminAdobeIMS Callback
62
-
63
62
For the AdobeIMS Login we provide a redirect_uri on the request. After a successful Login in AdobeIMS, we get redirected to provided redirect_uri.
64
63
65
64
In the ImsCallback Controller we get the access_token and then the user profile.
66
-
We then check if the assigned organization is valid and if the user does exist in the magento database, before we complete the user login in Magento.
65
+
We then check if the assigned organization is valid and if the user does exist in the Magento database, before we complete the user login in Magento.
67
66
68
67
If there went something wrong during the authorization, the user gets redirected to the admin login page and an error message is shown.
69
68
70
69
# Organization ID Validation
71
-
72
70
During the authorization we check if the configured `Organization ID` provided on the enabling CLI command is assigned to the user.
73
71
74
72
In the profile response from Adobe IMS must be a `roles` array. There we have all assigned organizations to the user.
75
73
76
74
We compare if the configured organization ID does exist in this array and also the structure of the organization ID is valid.
77
75
78
76
# Admin Backend Login
79
-
80
77
Login with the help Adobe IMS Service is implemented. The redirect to Adobe IMS Service is performed-
81
78
The redirect from Adobe IMS is done to \Magento\AdminAdobeIms\Controller\Adminhtml\OAuth\ImsCallback controller.
82
79
@@ -97,14 +94,12 @@ If token is valid, value token_last_check_time will be updated to current time a
97
94
If token is not valid, session will be destroyed.
98
95
99
96
# Admin Backend Logout
100
-
101
97
The logout from Adobe IMS Service is performed when Magento Admin User is logged out.
102
98
It's triggered by the event `controller_action_predispatch_adminhtml_auth_logout`
103
99
104
-
We do external LogOut by call to IMS. Session revoke is standard magento behavior
100
+
We do external LogOut by call to IMS. Session revoke is standard Magento behavior
105
101
106
102
# Admin Created Email
107
-
108
103
We created an Observer for the `admin_user_save_after` event. \
109
104
There we check if the customer object is newly created or not. \
110
105
When a new admin user got created in Magento, he will then receive an email with further information on how to login.
@@ -117,11 +112,11 @@ The notification mail will be sent inside our `AdminNotificationService` where w
117
112
# Error Handling
118
113
For the AdminAdobeIms Module we have two specific error messages and one general error message which are shown on the Admin Login page when an error occured.
119
114
120
-
###AdobeImsTokenAuthorizationException
115
+
###AdobeImsTokenAuthorizationException
121
116
Will be thrown when there was an error during the authorization. \
122
-
e. g. a call to AdobeIMS fails or there was no matching admin found in the magento database.
117
+
e. g. a call to AdobeIMS fails or there was no matching admin found in the Magento database.
123
118
124
-
###AdobeImsOrganizationAuthorizationException
119
+
###AdobeImsOrganizationAuthorizationException
125
120
Will be thrown when the admin user who wants to log in does not have the configured organization ID assigned to his AdobeIMS Profile.
126
121
127
122
### Error logging
@@ -133,28 +128,28 @@ Logging can be enabled or disabled in the config on changing the value for `adob
133
128
There you can switch the toggle for `Enable Logging for Admin Adobe IMS Module`
134
129
135
130
# Password usage in Admin UI
136
-
When the AdobeAdminIMS Module is enabled, we do not need any password fields in the magento admin backend anymore.
131
+
When the AdobeAdminIMS Module is enabled, we do not need any password fields in the Magento admin backend anymore.
137
132
138
-
So we hide the "Current User Verification" fields and removed the "Password" and "Password Confirmation" fields of the user forms.
139
-
This is done by the Plugin`\Magento\AdminAdobeIms\Plugin\RemovePasswordAndUserConfirmationFormFieldsPlugin`.
140
-
Here we remove the password and password confirmation field, and hide the current user verification fieldset.
133
+
So we removed the "Password" and "Password Confirmation" fields of the user forms.
134
+
This is done by the plugin`\Magento\AdminAdobeIms\Plugin\RemovePasswordAndUserConfirmationFormFieldsPlugin`.
135
+
Here we remove the password and password confirmation field.
141
136
As the verification field is just hidden, we set a random password to bypass the input filters of the Save and Delete user Classes.
142
-
The `\Magento\AdminAdobeIms\Plugin\RemoveUserValidationRulesPlugin` Plugin is required to remove the password fields from the form validation.
137
+
The `\Magento\AdminAdobeIms\Plugin\RemoveUserValidationRulesPlugin` plugin is required to remove the password fields from the form validation.
138
+
We update the "Current User Identity Verification" fieldset to add "Verify Identity with Adobe IMS" button instead "Your Password" field.
139
+
This is done by the plugins: `Magento\AdminAdobeIms\Plugin\Block\Adminhtml\User\Edit\Tab\AddReAuthVerification`, `Magento\AdminAdobeIms\Plugin\Block\Adminhtml\System\Account\Edit\AddReAuthVerification`, `Magento\AdminAdobeIms\Plugin\Block\Adminhtml\User\Role\Tab\AddReAuthVerification` and `Magento\AdminAdobeIms\Plugin\Block\Adminhtml\Integration\Edit\Tab\AddReAuthVerification`.
143
140
144
-
As we don't show the current user verification field anymore, we have the `\Magento\AdminAdobeIms\Plugin\ReplaceVerifyIdentityWithImsPlugin`Plugin to verify the `access_token` of the current admin user in AdobeIMS and only proceed when it is still valid.
141
+
As we update the current user verification field, we have the `\Magento\AdminAdobeIms\Plugin\ReplaceVerifyIdentityWithImsPlugin`plugin to verify the `AdobeReAuthToken` of the current admin user in AdobeIMS and only proceed when it is valid.
145
142
146
143
For the newly created user will be a random password generated, as we did not modify the admin_user table, where the password field can not be null.
147
144
This is done in the `\Magento\AdminAdobeIms\Plugin\UserSavePlugin`.
148
145
149
-
We also disabled the "Change password in 30 days" functionally, as we don't need the magento admin user password for the login.
146
+
We also disabled the "Change password in 30 days" functionally, as we don't need the Magento admin user password for the login.
150
147
This can be found in the `\Magento\AdminAdobeIms\Plugin\DisableForcedPasswordChangePlugin` and `\Magento\AdminAdobeIms\Plugin\DisablePasswordResetPlugin` Plugins.
151
148
152
149
When the AdminAdobeIMS Module is disabled, the user can not be log in when using an empty password.
153
150
Instead, the forgot password function must be used to reset the password.
154
151
155
-
156
152
# WEB API authentication using IMS ACCESS_TOKEN
157
-
158
153
When Admin Adobe IMS is enabled, Adobe Commerce admin users will stop having credentials (username and password).
159
154
These admin user credentials are needed for getting token that can be used to make requests to admin web APIs.
160
155
It means that will be not possible to create token because admin doesn't have credentials. In these case we have to use IMS access token.
Both of values are checked in function isTokenExpired \Magento\AdminAdobeIms\Model\TokenReader.
178
173
it means that with default values is not possible to use tokens that older than 4h.
179
174
180
-
###IMS access token verification.
175
+
###IMS access token verification.
181
176
To verify token a public key is required. For more info https://wiki.corp.adobe.com/display/ims/IMS+public+key+retrieval
182
177
In Admin Adobe Ims module was defined path where certificate has to be downloaded from.
183
178
By default, in config.xml, these value for production.
@@ -201,9 +196,8 @@ Examples, how developers can test functionality:
201
196
curl -X GET "{domain}/rest/V1/customers/2" -H "Authorization: Bearer AddAdobeImsAccessToken"
202
197
curl -X GET "{domain}/rest/V1/products/24-MB01" -H "Authorization: Bearer AddAdobeImsAccessToken"
203
198
204
-
###Two-factor authentication.
205
-
206
-
During CLI enablement of the module, the admin user is asked, whether 2FA is enabled for him on Adobe side.
199
+
### Two-factor authentication.
200
+
During CLI enablement of the module, the admin user is asked, whether 2FA is enabled for Organization in Adobe Admin Console.
207
201
If the answer is yes, Magento TFA module (if it's present in the code base), should be disable.
208
202
209
203
For this purpose the additional config value was added, this config value is read by Magento_TwoFactorAuth module.
@@ -222,4 +216,4 @@ When the form will be submitted, we verify the identity with the `Magento/AdminA
222
216
Here the existens of the `AdobeAccessToken` and `AdobeReAuthToken` will be checked.
223
217
The reauth_token will be used to call the AdobeIms validateToken Endpoint.
224
218
225
-
When this call is successfull, the form will be submitted, otherwise we update the Message of the thrown `AuthenticationException` to return a matching error message, done by the `Magento/AdminAdobeIms/Plugin/PerformIdentityCheckMessagePlugin.php` Plugin.
219
+
When this call is successful, the form will be submitted, otherwise we update the Message of the thrown `AuthenticationException` to return a matching error message, done by the `Magento/AdminAdobeIms/Plugin/PerformIdentityCheckMessagePlugin.php` Plugin.
0 commit comments