@@ -27,7 +27,9 @@ Before completing this guide, you must [verify ownership of any domains]({{< rel
2727
2828 SAML assertion requires first and last name, which are not available in the default user profile.
2929
30- > ** Note** : Depending how they are created, users can have different profiles.
30+ {{<note >}}
31+ Depending how they are created, users can have different profiles.
32+ {{</note >}}
3133
3234 {{<image filename="images/rc/saml/auth0_saml_1.png" >}}
3335
@@ -37,39 +39,60 @@ Before completing this guide, you must [verify ownership of any domains]({{< rel
3739
3840 The key-value pair of ` redisAccountMapping ` consists of a lowercase role name (owner, member, manager, billing_admin, or viewer) and your Redis Cloud Account ID found in the [ account settings] ({{< relref "/operate/rc/accounts/account-settings" >}}).
3941
40- ```
42+ ``` json
4143 {
4244 "FirstName" : " Test" ,
4345 "LastName" : " User" ,
4446 "redisAccountMapping" : " YOUR_REDIS_CLOUD_ID=owner"
4547 }
4648 ```
4749
48- 1. Open **Auth Pipeline > Rules ** and select **Create **.
50+ 1 . Open **Actions > Triggers ** and select **`post-login` **.
4951
5052 {{<image filename="images/rc/saml/auth0_saml_3.png" > }}
5153
52- 1. Pick a rule template then select **Empty rule**.
53-
54- 1. Provide a **name** for the rule and add the following script.
55-
56- ```
57- function mapSamlAttributes(user, context, callback) {
58- user.user_metadata = user.user_metadata || {};
59- context.samlConfiguration.mappings = {
60- "Email": "email",
61- "LastName": "user_metadata.LastName",
62- "FirstName": "user_metadata.FirstName",
63- "redisAccountMapping": "user_metadata.redisAccountMapping"
64- };
65- callback(null, user, context);
66- }
54+ 1 . Select **Create Action** to create a new custom action.
55+
56+ {{<image filename="images/rc/saml/auth0_saml_add-action.png" > }}
57+
58+ 1 . Provide a **name** for the action and select **Create**.
59+
60+ {{<image filename="images/rc/saml/auth0_saml_create-action.png" > }}
61+
62+ 1 . Add the following code to the action:
63+
64+ ```js
65+ exports.onExecutePostLogin = async (event, api) => {
66+ const um = event.user.user_metadata || {};
67+ const am = event.user.app_metadata || {};
68+ api.samlResponse.setAttribute('email', event.user.email);
69+ api.samlResponse.setAttribute(
70+ 'firstName',
71+ um.FirstName || ''
72+ );
73+ api.samlResponse.setAttribute(
74+ 'lastName',
75+ um.LastName || ''
76+ );
77+ const mapping = am.redisAccountMapping || um.redisAccountMapping;
78+ if (mapping) {
79+ api.samlResponse.setAttribute('redisAccountMapping', mapping);
80+ } else {
81+ api.access.deny('missing_redis_account_mapping', 'redisAccountMapping not set for user');
82+ }
83+ };
6784 ```
6885
69- 1. Select **Save Changes** .
86+ 1 . Select **Deploy** to save and deploy the action .
7087
7188 {{<image filename="images/rc/saml/auth0_saml_4.png" > }}
7289
90+ 1 . Return to the **`post-login`** trigger and drag the action you just created to the trigger.
91+
92+ {{<image filename="images/rc/saml/auth0_saml_action-trigger.png" > }}
93+
94+ Select **Apply** to save your changes.
95+
7396### Create and configure the SAML application
7497
75981 . Open **Applications > Applications** and select **Create Application**.
@@ -97,7 +120,7 @@ Before completing this guide, you must [verify ownership of any domains]({{< rel
97120 * Copy and save the **Issuer** value.
98121 * Copy and save the **Identity Provider Login URL**.
99122
100- You will need both of these values, along with the certificate value you copied in the previous step, to configure SAML in admin console.
123+ You will need both of these values, along with the certificate value you copied in the previous step, to configure SAML in the Redis Cloud console.
101124
102125 {{<image filename="images/rc/saml/auth0_saml_9.png" > }}
103126
@@ -139,25 +162,25 @@ To activate SAML, you need to have a local user (or social sign-on user) with th
139162
140163## Step 3: Finish SAML configuration in Auth0
141164
142- 1. Return to the Auth0 SAML application and select **Addons > Settings**:
165+ 1 . Return to the Auth0 SAML application and select **Addons > SAML 2 Web App > Settings**:
143166
144167 {{<image filename="images/rc/saml/auth0_saml_10.png" > }}
145168
146169 * Paste the **Location** link in **Application Callback URL** field.
147170
148- * To update the **Settings** code area, add this code . Modify the `audience` variable with the `EntityID` value from the metadata file you downloaded. Also, modify the `recipient` variable with the `Location` value from the metadata file you downloaded.
171+ * Enter the following code in the **Settings** code area. Modify the `audience` variable with the `EntityID` value, and the `recipient` variable with the `Location` value from the metadata file you downloaded.
149172
150- ```
173+ ```json
151174 {
152- "audience": "ENTITYID VALUE FROM FILE ",
153- "recipient": "LOCATION VALUE FROM FILE ",
175+ "audience" : " <EntityID> " ,
176+ "recipient" : " <Location> " ,
154177 "passthroughClaimsWithNoMapping" : false ,
155178 "nameIdentifierProbes" : [
156179 " http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress"
157180 ]
158181 }
159182 ```
160- Scroll down and select **Save ** to apply the configuration.
183+ Scroll down and select **Enable ** to apply the configuration.
161184
162185### IdP initiated SSO
163186
0 commit comments