# SSO settings

If you have a corporate identity provider that supports the **OIDC** (OpenID Connect) **protocol**, or if you are using an SSO provider that also works with the OIDC protocol (such as [Okta](https://docs.whitespots.io/appsec-portal/general-portal-settings/sso-settings/okta-sso), Auth0, Google Identity Platform, [Microsoft identity platform](https://docs.whitespots.io/appsec-portal/general-portal-settings/sso-settings/microsoft-sso), [GitLab](https://docs.whitespots.io/appsec-portal/general-portal-settings/sso-settings/gitlab-sso), Azure AD, AWS Cognito, Duo Security, and others), you can **configure Single Sign-On (SSO)** for your AppSec Portal.

You can automatically **synchronize roles** assigned to users in the corporate identity or at your SSO provider [by configuring the appropriate mapping](#role-mapping).

Authentication through SSO allows users to log in to the portal without the need to remember separate credentials.

### The setup process will include the following steps:

1. Add the "AppSec Portal" application as a client in the settings of your SSO provider.

<figure><img src="https://3069717380-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M81VrXQrfSaYjNIFOtt%2Fuploads%2F9hsUSkQfzns35ZEG4V41%2FOkta%20corr.gif?alt=media&#x26;token=704b7532-0f74-4441-a440-86b5c06333a9" alt=""><figcaption><p>Example for Okta</p></figcaption></figure>

2. Navigate to the administrative panel of AppSec Portal: \
   \&#xNAN;***Settings -> Users and Roles -> SSO integrations***
3. On the right panel, select Add SSO (+ SSO)
4. In the SSO settings section, enter the parameters:\
   **Title**: Provide a title for the SSO integration. This title will be displayed during the login process.\
   **Domain**: Enter the domain of your SSO provider. \
   **Client ID**: Enter the client ID for your SSO connection settings obtained from your provider. **Client Secret**: Enter the client secret for your SSO connection settings obtained from your provider. \
   **Server Metadata URL**: If your provider's metadata URL **is not** unique, you can leave this field with the default value. \
   **Scopes**: By default, the scope includes the OpenID, email, and profile parameters. You can remove specific parameters if necessary. \
   **Use Self-Signed Certificate**: Activate this option if it's necessary for your setup. \
   **Allowed Email Domains**: Enter the allowed email domains as a comma-separated list if necessary. \
   **Roles**: Choose roles from the dropdown list to be assigned to each user authenticated using this method if necessary.<br>
5. Click "Create"

<figure><img src="https://3069717380-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M81VrXQrfSaYjNIFOtt%2Fuploads%2FjF5zKVQc5pDKRsCT2mil%2Fokta2.gif?alt=media&#x26;token=23766b8e-bf7f-4f1f-a9ad-0ec7548fabb3" alt=""><figcaption></figcaption></figure>

6. Ensure that the authentication and authorization process is functioning correctly, and that users can securely and conveniently access the portal.

<figure><img src="https://3069717380-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M81VrXQrfSaYjNIFOtt%2Fuploads%2FjEq8tKka2w7O7N0ShtzA%2Flogin%20Okta.gif?alt=media&#x26;token=d29b1e59-def7-42fe-acd2-a1d53fa3682f" alt=""><figcaption></figcaption></figure>

### Role Mapping

If roles are configured for users in your SSO provider, a specific role will be assigned to the user in the portal based on the configured mapping.&#x20;

If there are no roles configured in the provider, or if no mapping has been set in the portal, the user is automatically assigned the roles you specified in step 4 during SSO setup.

{% hint style="success" %}
The mapping check occurs each time a user logs in. \
In other words, if a role is added or removed for a user on the provider's side, their roles in the portal will be adjusted according to the mapping and newly received information from the provider upon each login.
{% endhint %}

Follow the steps below to configure the mapping:

1. Fill the "**JSON key in JWT token with list of external groups"** field with the name of the key by which the portal is able to get the list of external groups. It could be **groups** or **roles**, depending on which system is used

<figure><img src="https://3069717380-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M81VrXQrfSaYjNIFOtt%2Fuploads%2FNc3aDC1pyVd5WXTt6rGd%2Fphoto_2024-01-16%2023.09.26.jpeg?alt=media&#x26;token=2570867e-e83a-48af-9b62-06837f7f5492" alt=""><figcaption><p>SSO token example</p></figcaption></figure>

<figure><img src="https://3069717380-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M81VrXQrfSaYjNIFOtt%2Fuploads%2FxImNFtfLnfBqZc8MgcXD%2Fsso%20mapping1.png?alt=media&#x26;token=c6de274e-075d-4647-929f-7a7f038f7dac" alt=""><figcaption></figcaption></figure>

2. Click the button <img src="https://3069717380-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M81VrXQrfSaYjNIFOtt%2Fuploads%2FsrLBNBZt8Otr3HegQZ9h%2Fimage.png?alt=media&#x26;token=a5c7e9f0-9f86-4037-8b84-505e1f4e0886" alt="" data-size="line"> and match the role name from your provider and the Portal:

<figure><img src="https://3069717380-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M81VrXQrfSaYjNIFOtt%2Fuploads%2FSWgoMJGS0XaLJD2goA0P%2Fsso%20mapping2.png?alt=media&#x26;token=53d29a58-8bcf-4a21-aa23-96a6ca95fb5c" alt=""><figcaption></figcaption></figure>

3. Create a mapping for all external roles

<figure><img src="https://3069717380-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M81VrXQrfSaYjNIFOtt%2Fuploads%2Fh2BEYkm5fFeHZcLYkyOG%2Fsso%20mapping3.png?alt=media&#x26;token=ea78b567-1241-449e-84ec-f6f242af96bf" alt=""><figcaption></figcaption></figure>

If you have filled in the **JSON key in JWT token with list of external groups** field but **haven't** configured the **mapping,** upon the first login via Single Sign-On (SSO), the portal will display all roles received from your provider. You can map them later. <br>

<figure><img src="https://3069717380-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M81VrXQrfSaYjNIFOtt%2Fuploads%2FqGBdqZQdeRM1kgu8K1N4%2Fsso%20map.png?alt=media&#x26;token=da42826e-57d3-4ea8-b364-04478a98b9e0" alt=""><figcaption></figcaption></figure>
