# SSO with Auth0

Netography’s SAML and your Identity Provider settings need to be configured in parallel. To start, log in to your Netography account as an administrator.

1. Navigate to **Settings > SSO** and enable **SAML Single Sign-on**:
2. Copy the **Assertion consumer service (ACS) URL** in the **SAML Single Sign-On Settings** page that appears.. It will be needed as input into Auth0 later.

### Auth0 Walkthrough <a href="#auth0-walkthrough" id="auth0-walkthrough"></a>

\*Auth0 has updated their UI since these screenshots were taken. Consult Auth0 documentation for any changes to Auth0 configuration.\_

1. Navigate to **Applications** and click **Create Application**.

![](https://1075194167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7upncbzIm3grJePXaOO9%2Fuploads%2Fgit-blob-d99feee47002e4d6a233d879177d84e00f0b2384%2F2885c8dcfeebbb040fe057ce063239a14cbb06d85fd29802d0f298145a8a774a.png?alt=media)

2. Name the application **Netography** and set the application type as **Regular Web Applications**.

![](https://1075194167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7upncbzIm3grJePXaOO9%2Fuploads%2Fgit-blob-8d21592bca061a9eecc5a22c9439137e83803e2c%2F2ebeb0ffd4917a17706cfddbc0dbea02733fac33f0b98bc13fcf4c6f2bf549e1.png?alt=media)

3. Under the **Addons** tab, enable **SAML2 WEB APP**.

![](https://1075194167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7upncbzIm3grJePXaOO9%2Fuploads%2Fgit-blob-854391ad77e30fc15a4c9233c307fdf815e03be3%2F58ad0e258f5ab01f08862d671769781af5a884ddd549a2c8100a3b6a3d58b499.png?alt=media)

4. In the modal that appears, under the Settings tab, paste the **Assertion consumer service URL** into the **Application Callback URL** field.

   1. Additionally, paste the following code into the **Settings** textarea, replacing the placeholders with the appropriate values. Required mappings:
      * Email
      * Role

   ```
       {
         "logout": {
           "callback": <Assertion consumer service URL>
         },
         "mappings": {
           "email": "email",
           "nickname": "nickname",
           "phone_number": "phone_number",
           "picture": "picture",
           "role": "role"
         },
         "createUpnClaim": false,
         "passthroughClaimsWithNoMapping": false,
         "mapUnknownClaimsAsIs": false,
         "mapIdentities": false
       }
   ```

![](https://1075194167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7upncbzIm3grJePXaOO9%2Fuploads%2Fgit-blob-794de122fc3bcbe2eca558e349374960178458e2%2F5e2a0db0d28c033917244afb43da48cc20d1e9f32116b35036f36af68ee11ad6.png?alt=media)

5. Scroll to the bottom of the tab and click **Enable**.

![](https://1075194167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7upncbzIm3grJePXaOO9%2Fuploads%2Fgit-blob-174dfc27599d2305fbe13645ecf830b7a1985898%2Ffc1fee8a526c4d1d3efc05a028050583352ea2769b3d2379a1f803e1b50282cd.png?alt=media)

6. On the **Usage** tab, click Download (next to **Identity Provider Metadata**). You'll need to upload this file to Netography as part of the [Post-Configuration steps](https://support.netography.com/hc/en-us/articles/4403544816276)

![](https://1075194167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7upncbzIm3grJePXaOO9%2Fuploads%2Fgit-blob-8b22d394e99720b7e90b5284958b616d4f00b669%2F63db49895e38eb05c12cc6ec1c2c7b79e6d9ff8cf49a2dd5afb005f1fb6ce833.png?alt=media)

7. When defining mappings in the SAML2 Web App, attributes from the user profile are expected. Since Auth0's *user\_metadata* is not inherently part of the user profile, these have to be mapped manually. Required mappings are given\_name, family\_name, email and role.
   1. Go to **Dashboard > Auth Pipeline > Rules** and click **Create**.

{% hint style="warning" %}
**🚧Rules will be deprecated by 2024 in Auth0. For more information, see migrating from Rules to Actions**
{% endhint %}

7. In the list choose **Enrich Profile > SAML Attributes mapping**.

![](https://1075194167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7upncbzIm3grJePXaOO9%2Fuploads%2Fgit-blob-2dde41f176729615bdd43d65482d82a691aa763c%2Ff1d4eca01497d7b83545923645201b80ecefbc180c13b8775032b41d0cccbb61.png?alt=media)

3. Name the mapping “SAML Attributes mapping” and paste the following code into the **Script** textarea.

![](https://1075194167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7upncbzIm3grJePXaOO9%2Fuploads%2Fgit-blob-dcae867a8af91de6f41fea3a2e24ea2e67849402%2F9e62c03ef1c987c8bc981ae3d66bed19390ef489a69c4be5610b868c7c5f555c.png?alt=media)

````
  ```
     function mapSamlAttributes(user, context, callback) {
       context.samlConfiguration.mappings = {
         "given\_name": "user\_metadata.given\_name", // required
         "family\_name": "user\_metadata.family\_name", // required
         "email": "email", // required
         "role": "role", // required
         "nickname": "nickname", // optional
         "phone\_number": "phone\_number", // optional
         "picture": "picture" // optional
       };
       callback(null, user, context);
     }
  ```
````

### Netography Post-Configuration <a href="#netography-post-configuration" id="netography-post-configuration"></a>

1. Return to the Netography portal, and upload the **Identity provider metadata** file you downloaded above in the **Provider** section of the **SAML Single Sign-On Settings**.

![](https://1075194167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7upncbzIm3grJePXaOO9%2Fuploads%2Fgit-blob-2cecf83905f46b63c2dfd406208252b911cd9e1b%2F1c6e25f540748e38a7f37287e07b5fcdf2df4c7217954f11d1f9a6eb9e1dd88e.png?alt=media)

2. Click Next
3. Now configure the **User attribute mappers** to match the mapper values configured in Auth0 above:

![](https://1075194167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7upncbzIm3grJePXaOO9%2Fuploads%2Fgit-blob-88c468dd59af34afeb9dca7c0d0599c2c12333cf%2Fee483ac10f7ce37ff4b9cf1f254ba73f309a4c03cb8b0164f734b6e35aeefcd6.png?alt=media)

4. Click Next.
5. Next configure the Default user role and role mappers:
   1. Default user role: This is the role an IDM-authenticated user will default to if the role mappings are not found in the SAML exchange. For security purposes, we recommend setting this value to "readonly", but you may want to set this to "admin" as you are testing your configuration.
   2. Admin role mappers: Configure these according to the screenshot below:

![](https://1075194167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7upncbzIm3grJePXaOO9%2Fuploads%2Fgit-blob-a6ecb07efdd27c2b693bc8654cc9283c5bc2be9b%2F54ba5d7cafadbe8a5afed550c92327f4d7b695a5042bc71a84cd2ceadd3a693d.png?alt=media)

6. Click the **Save** button.

Done! Now your users can log in directly via your identity provider using a new account-specific login URL. The new SSO Login URL can now be found under the **Essentials** settings in the **SAML Single Sign-On Settings** page.

![](https://1075194167-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F7upncbzIm3grJePXaOO9%2Fuploads%2Fgit-blob-d44d92c9b923daa3195a579ebaa96de3801167ff%2F11dfdf8bed4da066db937d21220561ca20f72c0e467dc23260019ee04b76916e.png?alt=media)

{% hint style="warning" %}
**🚧The default login will still work for your account administrator, which is not bound to your IDM.**
{% endhint %}
