Skip to main content

Configure OpenSearch SSO with Keycloak

ClusterNest Managed OpenSearch can delegate Dashboards login to Keycloak over OIDC or SAML. A cluster takes several auth sources side by side, with at most one SAML source and one OIDC source offered on Dashboards.

You'll need your cluster's OpenSearch Dashboards hostname before registering the client. Set dashboards_custom_hostname so you know it upfront, or create the cluster first without an auth source and note the generated opensearch_dashboards_url output before adding it.

OIDC​

Keycloak's ID token doesn't include realm/client roles by default - roles_key only works once a matching mapper is attached to the client.

  1. In the Keycloak admin console, go to your realm's Clients > Create client.
    • Client type: OpenID Connect, Client ID: e.g. opensearch-dashboards
    • Client authentication: On (confidential client), Standard flow: enabled
    • Valid redirect URIs: https://<dashboards-hostname>/auth/openid/login
  2. On the Credentials tab, note the Client secret.
  3. To get a claim for roles_key, go to the client's Client scopes tab, open its dedicated scope, and add a Group Membership mapper with token claim name groups.

connect_url is https://<keycloak-host>/realms/<realm>/.well-known/openid-configuration.

In the ClusterNest console, open the cluster's create/edit form and add an OIDC source under Authentication. Choose a Name (it becomes the text of the Dashboards button, "Login with" followed by this name), tick Offer on OpenSearch Dashboards, then fill in:

  • Connect URL: https://auth.example.com/realms/myrealm/.well-known/openid-configuration
  • Client ID / Client Secret: from the client's Credentials tab
  • Roles Key: groups (or whatever your mapper's claim name is; leave blank if you skipped step 3)

See the Terraform resource reference for the full field list.