OpenSearch Dashboards SSO with Keycloak over OpenID Connect

Connect OpenSearch Dashboards to Keycloak through the Security plugin's OpenID Connect backend, with the claims, JWKS rollover and role mapping planned before go-live.

On this page

How OpenSearch Dashboards SSO with Keycloak works over OpenID Connect

Your team needs staff to sign in to OpenSearch Dashboards with their Keycloak identity instead of local accounts. The supported way to do this is the OpenSearch Security plugin's openid authentication domain, which federates Dashboards with an OpenID Connect provider. When Keycloak is the provider, the plugin reads the realm's metadata from openid_connect_url, fetches the signing keys from the JWKS endpoint advertised in that metadata, and validates the tokens Keycloak issues for each sign-in. DeployOpen plans and implements this federation in infrastructure you control, including the Keycloak realm, the OpenSearch cluster and the Dashboards configuration, so each piece can be reviewed by your security team before go-live.

The sign-in flow has three parts that you should design separately. First, Dashboards redirects the browser to Keycloak, which authenticates the user and returns an ID token. Second, the Security plugin validates that token against the keys it fetched from JWKS and extracts the user name from the claim named by subject_key, which is commonly preferred_username. Third, it reads the claim named by roles_key to decide which backend roles the user receives. Confirm the exact claim names your Keycloak client emits before you write any configuration, because a mismatch between the claim the token carries and the key named in config.yml is the most common reason a login succeeds at Keycloak but lands with no access in OpenSearch.

Key rollover needs a plan before the first deployment. The Security plugin fetches signing keys from the JWKS endpoint, so a Keycloak realm key rotation should be picked up without editing OpenSearch, but you should test that behavior in a non-production cluster and record how long your environment takes to reflect a new key. Keep the Keycloak client, the realm and the OpenSearch authentication settings under change control, and agree with your identity team who approves changes to the roles claim. Those decisions determine who can grant access to Dashboards, so they belong in the design review and not in an operator's notes.

What you need in place before configuring SSO with Keycloak

Before you touch the Security plugin, the OpenSearch cluster, Dashboards and Keycloak each need a known version, a working realm and client, encrypted endpoints and network paths the two products can use. A locked-out administrator is the most expensive surprise, so a break-glass account comes first. Confirm each item against the official docs for the exact versions you run.

Pinned OpenSearch and Keycloak versions

Record the exact OpenSearch, OpenSearch Dashboards and Keycloak versions you will run, including any Red Hat build of Keycloak distribution. Check the OpenID Connect configuration against the OpenSearch docs for your release, not an older tutorial, because option names and behavior can change between minor versions. OpenSearch maintenance windows and Keycloak's minor release cadence both affect how long a pinned version stays suitable. Confirm the support status of each version before you start.

OpenID Connect docs

A working Keycloak realm and client

Create a dedicated realm for OpenSearch users and an OpenID Connect client for Dashboards with the redirect URI that matches your Dashboards address. Confirm the client authentication mode, the scopes you will request and that the token carries the username and role claims you plan to map. Test sign-in with a plain OpenID Connect client or the Keycloak admin console before you involve OpenSearch, so faults are easier to separate.

Keycloak server admin guide

TLS on both endpoints

Serve Keycloak over HTTPS and confirm that OpenSearch REST and Dashboards use TLS with certificates your team controls. Decide which certificate authority the cluster trusts for the Keycloak endpoint and make sure the Keycloak certificate chain is complete. Plan certificate rotation now, since the JWKS and discovery endpoints must stay reachable when a certificate is renewed. Self-signed chains are a common cause of failed discovery calls.

Network paths to discovery and JWKS

The OpenSearch cluster must reach the openid_connect_url discovery document and the JWKS endpoint it lists, and the browser must reach Keycloak for login redirects. Check firewall rules, proxies, DNS and any network segmentation between the cluster nodes and the identity provider. Note that Dashboards and the cluster may sit in different network zones, so test from each side. Record the exact URLs so the configuration and the network tests use the same values.

A break-glass admin account

Keep a local admin user in the Security configuration that does not depend on Keycloak, and store its credentials in your secrets vault with a documented access procedure. Confirm that you can still log in with it after OpenID Connect is enabled and that it keeps the admin role. If the identity provider, certificates or role mappings fail, this account is how you restore access and roll back the change. Test it before the first production switch.

Configuring the openid domain and Keycloak client step by step

This sequence connects a Keycloak client to OpenSearch Dashboards through the Security plugin's openid domain, so that a user signing in through Keycloak lands in Dashboards with the roles their Keycloak groups grant. Each step ends with a check you can run before moving on.

  1. Create the Keycloak client and confirm redirect URIs

    In the Keycloak admin console, create an OpenID Connect client for Dashboards in the realm your users belong to, with client authentication enabled and the standard authorization code flow turned on. Register the Dashboards callback URL exactly as it is served (scheme, host, port and path), because Keycloak rejects any redirect that does not match. Record the client ID and secret for the Security configuration. Done when a test sign-in attempt from the client's settings page is accepted by Keycloak and the redirect URI list contains only the URLs you intend to use.

  2. Expose a roles claim in the token

    Add a mapper to the client (or a client scope) that writes realm or client roles, or group membership, into the ID token under a claim name you choose, such as roles. Keep the claim name identical to the value you will set for roles_key later. Decide whether to include the user name claim, commonly preferred_username, because it will be read as subject_key. Done when a token issued for a test user, decoded with a JWT inspection tool, shows the user name claim and the roles claim with the expected values.

  3. Set the openid domain and openid_connect_url

    In the Security plugin's authentication configuration (config.yml, applied with the Security admin tooling your team uses), add an openid_auth_domain under authc with http_authenticator type openid and the discovery document location in openid_connect_url, which points to the realm's .well-known/openid-configuration endpoint. Set the client ID and secret, and the Dashboards callback in the Dashboards configuration to match step one. Done when the discovery URL returns JSON from the OpenSearch nodes' network (test with curl from each node) and the configuration validates without errors on load.

  4. Set subject_key and roles_key

    Under the openid domain's configuration, set subject_key to the claim that holds the user name, typically preferred_username, and set roles_key to the claim from step two that lists roles. Confirm these names match the decoded token exactly, since claim names are case sensitive and a mismatch produces users with no roles rather than a clear error. Done when the decoded test token contains both claims with the values you expect, and the config is applied to the cluster.

  5. Confirm JWKS retrieval and key rollover handling

    The Security plugin reads the provider's metadata, then fetches signing keys from the JWKS endpoint that the discovery document advertises. Verify that the OpenSearch nodes can reach that endpoint, and check the cluster logs after a sign-in for key retrieval or signature validation errors. Plan for key rollover by confirming that the plugin picks up a new key without a restart: rotate the key in Keycloak in a test realm and sign in again. Done when the test sign-in validates the token signature with the rotated key and the logs show no signature failures.

  6. Map Keycloak roles to OpenSearch roles

    Create role mappings in the Security plugin that connect the role values arriving in the roles claim to OpenSearch roles, such as a Keycloak group named analysts mapped to a read-only OpenSearch role. Keep the mappings in version control alongside the rest of the security configuration. Apply the least-privileged role first and widen it only when a tester needs more access. Done when a user who holds only the test group sees exactly the indices and Dashboards features that role grants, and a user without the group is denied.

  7. Test a login end to end

    Sign in to OpenSearch Dashboards as a test user from a clean browser session, and confirm the redirect to Keycloak, the return to Dashboards, and the user name shown in the Dashboards account menu. Check the audit or security logs for the authentication event and the mapped roles. Repeat with a user from each role group. Done when every test user lands in Dashboards with the expected identity and permissions, and a user whose group was removed in Keycloak is refused on the next sign-in.

How a Dashboards login flows through Keycloak and back to OpenSearch

The login starts in the browser on the user network, which requests the Dashboards login page. Dashboards redirects the user to the Keycloak authorization endpoint in the identity provider tier, where the user authenticates and receives an authorization code. Dashboards then exchanges that code at the token endpoint and passes the ID token to the OpenSearch Security plugin, which fetches signing keys from the JWKS endpoint to verify the signature. Check that the subject_key and roles_key claims arrive as expected, and that the signing keys still validate after a key rollover.

Login path from browser through Dashboards and Keycloak back to the OpenSearch Security plugin.

Mapping Keycloak claims and roles to OpenSearch users and roles

This table compares each identity element in the Keycloak token with the OpenSearch setting that consumes it, so you can see where a user name, backend role or role mapping comes from. Read it as a checklist: confirm each claim in a real token from your own realm before you write the mapping. The main takeaway is that the user name, backend roles and OpenSearch roles are set in different places, and a mismatch in any one of them silently changes what the user can access.

ElementKeycloak sourceOpenSearch settingWhat to confirm
User nameClaim such as preferred_username, set by a client mappersubject_key in the openid authentication domainThe claim exists in the ID token or userinfo response for your client and holds the value you expect
Backend rolesClaim listing realm or client roles, usually from a protocol mapperroles_key in the openid authentication domainThe roles claim is present, and its values are the exact role names you plan to map
Realm rolesRoles defined at realm level and assigned to users or groupsBackend role name matched in a roles mapping of the security pluginRole names are case-sensitive and match the strings in the token, not the display names in the console
Client rolesRoles defined on one Keycloak client and included in the tokenBackend role names prefixed or formatted as your token mapper emits themOnly the client roles you intend are included, since the mapper may add roles for every client
OpenSearch rolesNot stored in Keycloak; assigned in the Security pluginRoles mapping linking backend roles or user names to OpenSearch rolesEach backend role maps to the least-privileged OpenSearch role that covers the team's need
Dashboards tenantsGroup or role membership in KeycloakTenant permissions granted through the OpenSearch role that the mapping selectsTenant access follows the mapped role, so test that each group lands in the intended tenant
Signing keysJWKS endpoint of the realm, which changes during key rolloverDiscovered from openid_connect_url and refreshed by the pluginSign-in still works after a key rotation in a test realm before you rotate in production

Handling JWKS key rollover without a login outage

The OpenSearch Security plugin does not store Keycloak's signing keys by hand. It reads the provider's metadata from openid_connect_url, fetches the signing keys from the JWKS endpoint, and supports key rollover, so a rotated Keycloak realm key can be picked up without editing the Dashboards or cluster configuration. That only holds if you test the rotation first. Run a planned key rotation in a non-production realm that mirrors your production client, redirect URIs, subject_key and roles_key mappings, and confirm that a new sign-in succeeds before you schedule the same change in production. Record which key ID the token carries before and after the rotation so you can show the change was expected.

After rotation, confirm the new key is in use by signing in with a test user who holds each mapped role, then check the Security plugin and Dashboards logs for token validation errors. If validation fails, the usual causes are a stale JWKS cache on the OpenSearch side, a realm that signs with a key the JWKS endpoint no longer publishes, or a client that still points at an old issuer. Keep the previous signing key active in Keycloak until every node has accepted sign-ins with the new one, and have a documented rollback that restores the prior key or the prior realm configuration. Do not disable the OpenID Connect domain to clear an error, because that removes the only single sign-on path for your users.

Identity-side changes can also break logins without touching the OpenSearch configuration. Keycloak documents that its minor releases may change behavior and that breaking changes are opt-in, and its upgrading guide describes automatic schema migration at startup, which you can switch to manual SQL for large deployments. If you run the Keycloak Operator, the operator documentation strongly recommends manual approval mode for operator updates. Put Keycloak upgrades through the same non-production test as key rotation, and read the Keycloak upgrading guide for each target version before you approve it.

Security settings that matter for OIDC sign-in to Dashboards

Single sign-on moves the trust decision from OpenSearch to Keycloak and to the URLs and keys that connect the two. The cards below cover the settings that decide whether that trust holds: how the endpoints are validated, who can change the mappings, how break-glass access works, what gets logged, and which Keycloak release line you run.

TLS validation for discovery and JWKS

OpenSearch reads Keycloak's metadata from openid_connect_url and fetches signing keys from the JWKS endpoint, so both calls must reach the real Keycloak realm over TLS that the cluster trusts. Confirm that the certificate chain for the Keycloak hostname is present in the trust store used by the Security plugin, and that the discovery URL points to the intended realm. A misconfigured trust path is the most common reason for failed sign-ins, and an untrusted endpoint is the wrong place to fix it by disabling checks. Ask your team to document which CA signs the Keycloak certificate and who renews it.

OpenID Connect docs

Control over the Keycloak client and mappings

The Keycloak client, its redirect URIs, and the claim mappers that populate subject_key and roles_key decide who receives which OpenSearch roles. Limit administrative rights in the Keycloak realm to a named group, and require change review for client settings and role mappings. Confirm that a user cannot add a role claim to their own profile through a self-service or attribute setting, because a mapped role claim is treated as a grant. Record who approved each change to the mapping.

Admin access that bypasses SSO

Dashboards with OpenID Connect enabled still needs a path for administrators when Keycloak is down or misconfigured. Decide which internal admin account remains available, where its credentials are stored, and who can use it, and keep that account out of day-to-day use. Test the break-glass path before go-live so the team knows it works. Confirm the exact behavior of basic login alongside OIDC in your Dashboards version with the OpenSearch security documentation and your own test cluster.

Audit logging of sign-ins

Sign-in events should be traceable to a user, a time, and a source address, both in Keycloak and in OpenSearch. Keycloak exposes admin and login events that must be enabled and forwarded to your log store, and OpenSearch audit logging must be configured to record authentication outcomes for Dashboards. Confirm which events each layer records, how long they are retained, and who can read them. Tie these logs to the change records for mappings so an unexpected role grant can be traced.

Keycloak metrics

Keycloak on a supported release line

Keycloak releases on a planned cadence, and minor releases can carry changes that affect realm and client behavior. The current release is 26.8.1, published October 13, 2026, and Keycloak states that breaking changes in a minor release are opt-in. Run a Keycloak version that is still receiving fixes, test upgrades against a copy of the realm, and confirm whether your distribution, such as a vendor build, follows the same schedule. Check the upgrade notes before each move and keep the Operator update approval mode under review.

Keycloak release updates

Common OpenID Connect failures in Dashboards and how to fix them

This table lists the failures teams most often hit when wiring Keycloak into OpenSearch Dashboards over OpenID Connect, with the likely cause and the first check for each. Work down the rows in order of the sign-in flow: discovery and trust first, then token claims, then role mapping and redirects. Most fixes are configuration corrections rather than changes to the cluster itself.

SymptomLikely causeFirst check
Dashboards cannot reach the provider at startup or on sign-inThe openid_connect_url is wrong, points to a hostname the Dashboards or cluster host cannot resolve, or is blocked by a firewall or proxyRequest the openid_connect_url from the Dashboards host with curl and confirm the metadata document loads and lists the expected issuer
TLS or certificate trust errors when fetching metadata or keysKeycloak is served with a certificate issued by an internal CA that the Dashboards or OpenSearch host does not trustConfirm the CA chain is installed in the trust store used by the Java or Node process that makes the call, and test with the same CA file
Login succeeds at Keycloak but the user name is empty or sign-in is refusedThe claim named in subject_key is missing from the ID or access token, often because the Keycloak client mapper does not include itDecode a token from a test sign-in and check whether the claim named in subject_key is present under the exact name configured
User signs in but has no access or only default permissionsThe claim named in roles_key is absent, uses a different name or nesting, or its values do not match role mapping entries in OpenSearchCompare the roles claim in the decoded token with the backend roles listed for the user in the security configuration and check case and spelling
Redirect fails with an invalid redirect URI error at KeycloakThe valid redirect URI in the Keycloak client does not exactly match the callback URL Dashboards sends, including scheme, host, port and pathCopy the callback URL from the Dashboards error or logs and compare it character by character with the client settings in Keycloak
Login loops or repeated failed token validation after a key rolloverDashboards or the Security plugin still holds old signing keys, or the JWKS endpoint has not yet published the new key during rotationFetch the JWKS endpoint, confirm the token's key ID is present, then restart or reload the security configuration and retest a fresh sign-in

Questions teams ask before setting up Keycloak SSO for OpenSearch Dashboards

What drives the cost of setting up Keycloak SSO for OpenSearch Dashboards?

The cost follows the amount of decision and verification work, not the number of clicks in the console. The main drivers are the role model, the number of environments, and how mature the existing Keycloak realm is. A small set of OpenSearch roles mapped from a few Keycloak roles is a contained job. A model with many teams, tenants, index patterns and document-level restrictions takes longer to design and test. If Keycloak already has a documented realm, clients and role naming, less discovery is needed. Ask any provider to price these items separately: discovery, role mapping design, build in each environment, testing, and handover. Ask which items recur, such as Keycloak upgrades and key rotation checks, and which are one-time.

How long does an OpenSearch Dashboards Keycloak SSO project take?

Duration depends on the same drivers as cost, plus how quickly your teams make decisions and how many environments must be verified. A single environment with an agreed role map is much shorter than a rollout across development, test and production with separate Keycloak realms. Schedule time for the identity team to create the OpenID Connect client, for the security team to review the role model, and for a change window in production. Ask the provider for a written timeline tied to the agreed scope. No duration is guaranteed in advance, so confirm which milestones depend on your approvals.

What do we need from our identity and security teams?

The work needs decisions and access from both teams before the build starts. Your identity team must confirm the Keycloak version and realm, provide an OpenID Connect client for Dashboards, and agree which claim carries the user name and which carries roles. Your security team must approve the role mapping, the TLS trust chain for the Keycloak endpoints, and how OpenSearch admin access is kept separate from ordinary SSO. Both teams should name an owner for key rollover, since the JWKS endpoint changes keys over time and the Security plugin must keep working through that change. Agree on who approves production changes before the engagement starts.

Can our internal team set up Keycloak SSO for OpenSearch Dashboards alone?

A team with working knowledge of both OpenSearch Security and Keycloak can do it alone, especially for one environment with a small role model. The risk lies in the gaps between the two products: claim names, role mapping, discovery URLs, and key rollover. Teams that have not configured the openid authentication domain before often need to test several claim paths and verify that role changes in Keycloak reach OpenSearch. Ask yourself whether someone will own the configuration after go-live, handle Keycloak upgrades, and review access changes. If the answer is unclear, a fixed-scope engagement can cover the build and handover while your team keeps ownership.

What does a fixed-scope quote for this work depend on?

A fixed-scope quote depends on written decisions about what will be built and tested. Most engagements are fixed-scope, so scope, deliverables and timelines are agreed in writing before work starts. The quote should state the number of environments, the Keycloak deployment and version, the list of OpenSearch roles and the Keycloak roles they map from, whether tenants or document-level security are in scope, and what evidence you receive at handover. Items outside that list, such as changes to other authentication backends or a new Keycloak realm, should be listed as separate changes. Ask for the assumptions behind the quote so you can see what would move the price or timeline.

Which Keycloak settings and OpenSearch settings must match?

The main match points are the OpenID Connect discovery URL, the client identifier and secret, the redirect URI registered for Dashboards, and the claims your configuration reads. In the OpenSearch OpenID Connect configuration, openid_connect_url should point to the discovery document of the Keycloak realm, and subject_key and roles_key must name claims that the Keycloak token actually contains. Confirm the claim names by inspecting a test token before writing role mappings. Keep the realm name, client and role names in a short written record so the OpenSearch role mapping can be checked against it.

What breaks after go-live, and how do we keep SSO working?

The most common failures after go-live are expired or rotated signing keys, role changes that do not reach OpenSearch, and Keycloak upgrades that alter token contents. The Security plugin fetches signing keys from the JWKS endpoint and supports key rollover, but you should test that rollover in a non-production environment before relying on it. Keycloak migrates its database schema automatically at startup by default, so upgrades should be tested first and the Keycloak Operator should use manual approval mode for updates. Keep a documented break-glass admin path that does not depend on SSO, and review role mappings on a set schedule.

Does Keycloak itself require a paid license for this setup?

Keycloak is open source and licensed under Apache 2.0, so the server itself does not require a license fee to use for this integration. The cost you pay is for the infrastructure, the database, the people who run it and any support contract. If you choose Red Hat build of Keycloak, Red Hat's supported distribution, that is a subscription with its own terms, so confirm the terms with Red Hat before you choose it. OpenSearch and OpenSearch Dashboards are also licensed under Apache 2.0. Ask your provider to separate the software licensing from the services fee in any quote.

How DeployOpen scopes and delivers Keycloak SSO for Dashboards

Every Keycloak SSO engagement starts from a written scope that names the OpenSearch and Dashboards versions, the Keycloak deployment (its database, high availability design and whether it runs on the Keycloak Operator), the realm and client definitions, the role model and the test users and groups that will be used for acceptance. The scope also states what is out of scope, such as SAML or LDAP sign-in beside OIDC, Dashboards tenant design and access to the Keycloak administration console. Deliverables, acceptance criteria and the timeline are agreed in writing before work begins, so both sides know when the work is complete. Ask for the scope to list each item the client will provide, including the Keycloak administrator, the OpenSearch admin certificate and a change window for the Dashboards restart.

Delivered work typically includes the opensearch_dashboards.yml and config.yml changes for the openid authentication domain, the Keycloak client definition with its redirect URI and the subject_key and roles_key claim settings, the role mapping files applied to the cluster, and a test evidence pack showing sign-in, denied access for users without a mapped role and behavior after a signing key rollover. A runbook covers rotating the client secret, checking the JWKS endpoint, adding a new role mapping and rolling back to the previous configuration. Ask for each artifact to be named in the statement of work and for the evidence to be kept in the client's own repository, not only in a report.

Optional retainers cover work that recurs after go-live: applying OpenSearch and Keycloak upgrades on the release cadence each project publishes, reviewing configuration after changes to the identity provider, and repeating authentication tests on a schedule. Retainer terms, response expectations and the boundary between retainer work and new fixed-scope projects should be written down and priced in the quote, which DeployOpen produces from the agreed scope.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.