Enable JWT authentication on the OpenSearch cluster
A cluster administrator configures the OpenSearch Security plugin to accept JWTs by adding a jwt_auth_domain block to config/opensearch-security/config.yml and applying it with securityadmin.sh. This step is one-time — end users creating connections can skip it if the admin has already enabled JWT.
Add the jwt_auth_domain block to config.yml
Sample block using an HMAC shared secret. For RSA or ECDSA, set signing_key to the (non-Base64-encoded) public key wrapped in -----BEGIN PUBLIC KEY----- / -----END PUBLIC KEY----- — the plugin auto-detects the algorithm. For a rotating IdP, use jwks_uri in place of signing_key.
- “
yaml jwt_auth_domain: http_enabled: true transport_enabled: true order: 0 http_authenticator: type: jwt challenge: false config: signing_key: "<base64-encoded HMAC secret>" jwt_header: "Authorization" jwt_url_parameter: null subject_key: null roles_key: null required_audience: null required_issuer: null jwt_clock_skew_tolerance_seconds: 20 authentication_backend: type: noop“ - Apply the config with
plugins/opensearch-security/tools/securityadmin.shand reload. - Because JWTs are self-contained,
authentication_backendis set tonoop. - Full reference: JSON Web Token authentication.
Configure the claim-to-role mapping
Once JWT auth accepts the token, the user still needs mapped OpenSearch roles.
- The subject claim (
subby default) becomes the OpenSearch username. Override withsubject_keyif your IdP puts the username elsewhere. - The
roles_keyconfig value points at the claim carrying the user’s role list. Set it (e.g.roles_key: "roles") if you want the JWT to carry OpenSearch role membership. - Alternatively, map the subject or a backend role via Dashboards: Security > Roles > select role > Mapped users > Manage mapping > Map.
Generate a signed JWT from your identity provider
Sign in to your IdP (Okta, Azure AD, Auth0, or a custom signing service) and mint a JWT for the integration user. The token must be signed with the same key material the cluster is configured to verify.
Add the required claims to the token
The cluster validates these claims automatically:
- Include a
subclaim (or thesubject_keyclaim your admin configured) whose value the cluster’s role-mapping recognises. - Include an
exp(expiration) claim reasonable for the workload. Long-lived tokens are simpler; short-lived tokens are safer — the cluster tolerates up tojwt_clock_skew_tolerance_seconds(default 30 seconds) of clock drift. - If
required_audienceorrequired_issuerare set on the cluster, the token must include matchingaud/issclaims — otherwise the request is rejected as unauthorised. - Supported algorithms: HS256/384/512 (HMAC), RS256/384/512 (RSA), PS256/384/512 (RSA-PSS), ES256/384/512 (ECDSA).
- Short-lived tokens must be refreshed externally before expiry — the connector does not refresh them automatically. When your token nears
exp, generate a new one and update the connection.
Copy the endpoint URL
Enter the fully-qualified HTTPS URL of your cluster’s REST API.
Copy the URL from your platform
The URL depends on your deployment.
- For self-hosted clusters, an HTTPS URL to the cluster’s REST port (default
9200). - For hosted providers with JWT support, the endpoint URL is shown in the provider’s console.
- The URL must use HTTPS — the Security Plugin requires TLS.
- No trailing slash.
Verify the credentials
Verify the token round-trips through the cluster before configuring the connector.
Verify with a manual health check
From a shell that can reach the cluster, send GET /_cluster/health with the Authorization: Bearer <jwt> header and inspect the response:
- 200 OK with a JSON status — the token is accepted.
- 401 Unauthorized — the JWT signature or claims don’t validate. Check that the
signing_keyon the cluster matches the IdP’s signing key, thatrequired_audience/required_issuer(if set) match the token, and thatexphas not passed. - 403 Forbidden — the JWT authenticates but the subject / roles claim is not mapped to a role with the required permissions. Update role mapping in Dashboards or the
roles_keyclaim in the token.
Enter credentials in StackOne Hub
Paste the values below into StackOne Hub to connect the account.
Fill in the connection fields
Copy each value from the JWT and the cluster endpoint.
- OpenSearch Endpoint URL — the HTTPS endpoint from step 3.
- JWT Bearer Token — paste the JWT exactly as issued (three base64url segments separated by dots). Do not add the
Bearerprefix — StackOne adds it automatically. - OpenSearch Dashboards URL — optional. Required only for
dashboards_*actions. Leave blank for core datasync workflows.
Linking the Account from the Hub
Navigate to the Hub
Fill out the fields
- OpenSearch Endpoint URL
- JWT Bearer Token
- OpenSearch Dashboards URL (Optional)
Connect
- Click Connect
- If applicable, the provider will redirect you to a sign-in or authorization page. Complete the provider’s authorization flow.
- Once authorization is successful, you will see a confirmation popup
If the account linking is successful, you will see the newly linked account in your Accounts page.