> ## Documentation Index
> Fetch the complete documentation index at: https://wundergraphinc-ludwig-eng-9915-redis-read-replica-support.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Keycloak

> Setting up SSO with Keycloak

### Steps to set Keyclaok as an OIDC identity provider

<Steps>
  <Step>
    Navigate to the **Clients** view within your Keyclaok Dashboard.
  </Step>

  <Step>
    Click on **Create Client**.
  </Step>

  <Step>
    Select OpenID Connect as the **Client Type, and** give the client a  **Client ID**and a  **Name**and then click on **Next.**

    <Frame>
      <img src="https://mintcdn.com/wundergraphinc-ludwig-eng-9915-redis-read-replica-support/_kkCDafCtzfdOZJJ/images/studio/sso/create-openid-connect-client.png?fit=max&auto=format&n=_kkCDafCtzfdOZJJ&q=85&s=64afc782030a6c639376a8e8210c80aa" alt="Create client form for OpenID Connect with general, capability, and login settings" title="Create OpenID Connect client" width="2304" height="1401" data-path="images/studio/sso/create-openid-connect-client.png" />
    </Frame>
  </Step>

  <Step>
    Enable **Client authentication,** then click on **Next** and then click on  **Save**on the next page**.**

    <Frame>
      <img src="https://mintcdn.com/wundergraphinc-ludwig-eng-9915-redis-read-replica-support/_kkCDafCtzfdOZJJ/images/studio/sso/create-client-settings-overview.png?fit=max&auto=format&n=_kkCDafCtzfdOZJJ&q=85&s=2d0ed776ac704e88606ef3f3e6cbc730" alt="Create client page in Cosmo Docs with client authentication on and authorization off" title="Create client settings overview" width="2304" height="1413" data-path="images/studio/sso/create-client-settings-overview.png" />
    </Frame>
  </Step>

  <Step>
    Navigate to the **Credentials** tab and then copy the **Client Secret.**

    <Frame>
      <img src="https://mintcdn.com/wundergraphinc-ludwig-eng-9915-redis-read-replica-support/_kkCDafCtzfdOZJJ/images/studio/sso/client-authenticator-with-id-and-secret.png?fit=max&auto=format&n=_kkCDafCtzfdOZJJ&q=85&s=6ec9243d35aa4d3fca7e87ad25f9fbd9" alt="Client Authenticator settings showing client ID, secret, and regenerate option" title="Client Authenticator with ID and secret" width="2304" height="1166" data-path="images/studio/sso/client-authenticator-with-id-and-secret.png" />
    </Frame>
  </Step>

  <Step>
    Navigate to the **Realm Settings** and then copy the link of **OpenID Endpoint Configuration.**

    <Frame>
      <img src="https://mintcdn.com/wundergraphinc-ludwig-eng-9915-redis-read-replica-support/_kkCDafCtzfdOZJJ/images/studio/sso/openid-and-saml-metadata-settings.png?fit=max&auto=format&n=_kkCDafCtzfdOZJJ&q=85&s=0a45168b347ef0e3562afdb760d05db4" alt="OpenID and SAML metadata settings with user-managed access turned off" title="OpenID and SAML metadata settings" width="1497" height="335" data-path="images/studio/sso/openid-and-saml-metadata-settings.png" />
    </Frame>
  </Step>

  <Step>
    Navigate to the settings page on Cosmo.
  </Step>

  <Step>
    Click on **Connect.**

    <Frame>
      <img src="https://mintcdn.com/wundergraphinc-ludwig-eng-9915-redis-read-replica-support/_kkCDafCtzfdOZJJ/images/studio/sso/organization-settings-with-ai-rbac-scim.png?fit=max&auto=format&n=_kkCDafCtzfdOZJJ&q=85&s=922f85fba93582d07a93048d58c6f3b7" alt="Organization settings showing name, slug, and status of AI, RBAC, and SCIM features" title="Organization settings with AI, RBAC, SCIM" width="2796" height="1902" data-path="images/studio/sso/organization-settings-with-ai-rbac-scim.png" />
    </Frame>
  </Step>

  <Step>
    Give the connection a name, paste the **OpenID Endpoint Configuration** copied before, into the  **Discovery Endpoint,**and paste the **Client ID** and  **Client secret**copied before into the **Client ID** and  **Client Secret fields respectively,** and then click on **Connect.**

    <Frame>
      <img src="https://mintcdn.com/wundergraphinc-ludwig-eng-9915-redis-read-replica-support/_kkCDafCtzfdOZJJ/images/studio/sso/oidc-provider-configuration-form.png?fit=max&auto=format&n=_kkCDafCtzfdOZJJ&q=85&s=020aa7ee96edd64431ec0a9a0a3ac7ec" alt="Connect OpenID Connect Provider form with fields for name, endpoint, and credentials" title="OIDC provider configuration form" width="2786" height="2122" data-path="images/studio/sso/oidc-provider-configuration-form.png" />
    </Frame>
  </Step>

  <Step>
    Configure the mapping between the roles in Cosmo and the user groups in Keycloak. The field **Group in the provider** can be populated with the name of the group or a regex to match the user groups. Once all the mappers are configured, click on **Save**.

    <Frame>
      <img src="https://mintcdn.com/wundergraphinc-ludwig-eng-9915-redis-read-replica-support/_kkCDafCtzfdOZJJ/images/studio/sso/group-to-role-mapping-dialog.png?fit=max&auto=format&n=_kkCDafCtzfdOZJJ&q=85&s=6ed025749b23c1810e863ae45a06a1a8" alt="Group mapper configuration dialog linking provider groups to Cosmo roles" title="Group-to-role mapping dialog" width="2774" height="1972" data-path="images/studio/sso/group-to-role-mapping-dialog.png" />
    </Frame>
  </Step>

  <Step>
    Copy the sign-in and sign-out redirect URIs displayed in the dialog.

    <Frame>
      <img src="https://mintcdn.com/wundergraphinc-ludwig-eng-9915-redis-read-replica-support/_kkCDafCtzfdOZJJ/images/studio/sso/oidc-provider-configuration-steps.png?fit=max&auto=format&n=_kkCDafCtzfdOZJJ&q=85&s=6fe40fb7e4bd24e95442fb80ccb1dadd" alt="Steps to configure OIDC provider with sign-in and sign-out redirect URLs" title="OIDC provider configuration steps" width="2784" height="1848" data-path="images/studio/sso/oidc-provider-configuration-steps.png" />
    </Frame>
  </Step>

  <Step>
    Navigate back to the client created on Keycloak and populate the **Valid redirect URIs** and **Valid post Logout redirect URIs** with the above-copied sign-in and sign-out URLs respectively. Click on **Save**.

    <Frame>
      <img src="https://mintcdn.com/wundergraphinc-ludwig-eng-9915-redis-read-replica-support/_kkCDafCtzfdOZJJ/images/studio/sso/access-settings-for-redirect-urls.png?fit=max&auto=format&n=_kkCDafCtzfdOZJJ&q=85&s=774f293843fe4df4fa4260e5fca62638" alt="Access settings showing valid redirect and logout URLs fields" title="Access settings for redirect URLs" width="2304" height="1046" data-path="images/studio/sso/access-settings-for-redirect-urls.png" />
    </Frame>
  </Step>

  <Step>
    Navigate to the **Client Scopes** tab, click on the first client scope(usually would be \$\{**clientID}-dedicated**), and then click on **Configure a new mapper.**

    <Frame>
      <img src="https://mintcdn.com/wundergraphinc-ludwig-eng-9915-redis-read-replica-support/_kkCDafCtzfdOZJJ/images/studio/sso/client-scope-with-no-mappers-configured.png?fit=max&auto=format&n=_kkCDafCtzfdOZJJ&q=85&s=ddb72ea9b06024d7183138e1c5ecee75" alt="Client scope page showing dedicated mappers section with no mappers added" title="Client scope with no mappers configured" width="2304" height="1400" data-path="images/studio/sso/client-scope-with-no-mappers-configured.png" />
    </Frame>
  </Step>

  <Step>
    Select **Group Membership.**

    <Frame>
      <img src="https://mintcdn.com/wundergraphinc-ludwig-eng-9915-redis-read-replica-support/_kkCDafCtzfdOZJJ/images/studio/sso/group-membership-mapper-configuration.png?fit=max&auto=format&n=_kkCDafCtzfdOZJJ&q=85&s=dc53299706b69e562b81e4838bcdade2" alt="Configure new mapper dialog with Group Membership option for token mapping" title="Group membership mapper configuration" width="1782" height="1600" data-path="images/studio/sso/group-membership-mapper-configuration.png" />
    </Frame>
  </Step>

  <Step>
    Give the mapper a name, then populate the **Token Claim Name** with **"**ssoGroups**"** and then click on **Save.**
  </Step>

  <Step>
    Now you can assign users/groups to the application, and those users will be able to log into Cosmo using the URL provided on setting up the provider.
  </Step>
</Steps>
