Skip to main content
Version: Nightly

Map Okta Groups to GreptimeDB Roles

Use role-based access control (RBAC) to grant GreptimeDB Enterprise permissions based on Okta group membership. With the Okta Org Authorization Server, GreptimeDB verifies the access token using remote OpenID Connect (OIDC) introspection, reads groups from UserInfo, and resolves the matching database roles. The roles supply the privileges and access control lists (ACLs). GreptimeDB identifies the single sign-on (SSO) user by the issuer and sub and derives that user's permissions during authentication. The SSO identity stays out of the user store, and existing password accounts keep working.

Version compatibility

This guide applies to Nightly. Use a GreptimeDB Enterprise build that supports jwt_auth.group_role_mapping_file and an SSO-capable Enterprise Dashboard. If you use dashboard-apiserver, use a version that forwards Bearer credentials.

1. Configure the Okta Application​

Follow Configure Okta to set up an OIDC Single-Page Application with Authorization Code + PKCE and Client authentication set to None. Use your Okta org URL as the issuer, for example https://your-org.okta.com; /oauth2/default is a custom authorization server outside this guide's scope. Register the exact Dashboard sign-in redirect URI, such as https://dashboard.example.com/dashboard/auth/callback, and note the app's client ID.

Okta's Org Authorization Server issues access tokens for Okta's own resources, and its token audience cannot be customized. In remote OIDC mode, GreptimeDB binds a token to jwt_auth.issuer and jwt_auth.client_id through introspection and accepts it without checking an audience. Every active Bearer access token that Okta issues to this client with the openid scope passes that check. Deployments that require tokens minted for a dedicated API audience need Okta's custom authorization servers, which is outside this guide's scope.

For this example, use two Okta groups, greptimedb-alpha-readers and greptimedb-beta-readers, with a different test user in each. Assign both groups to the application in Assignments. Verify the app assignments and group memberships separately. If you use existing groups, substitute their names in the following steps.

2. Return Groups from Okta UserInfo​

Open the app's Sign On settings and edit Group Claims under OpenID Connect ID Token. If the fields are hidden, expand Show legacy configuration. Set the claim name to groups.

Choose the claim type by the source of the groups themselves. Check which of those groups each user belongs to in Directory → People, then check each group's source in Directory → Groups. A directory-synced user who belongs to an Okta-native group uses the same name filter as an Okta-native user.

  • Okta-native groups only: Select Filter → Matches regex. Match only the groups used by this deployment:

    ^greptimedb-(alpha|beta)-readers$
  • Imported or mixed-source groups: Select Expression. Replace the placeholders with the Okta group IDs of the groups you want to allow:

    getFilteredGroups({"<OKTA_GROUP_ID_1>", "<OKTA_GROUP_ID_2>"}, "group.name", 40)

    The expression returns the names of the listed groups that the user belongs to. 40 is the per-user result limit. GreptimeDB matches the returned group names, so give the allowed groups distinct names. See Okta's static group allowlist guide.

  • Groups from one directory with a dedicated prefix: If matching by name is appropriate, use Groups.startsWith("<DIRECTORY_INSTANCE_ID>", "greptimedb-", 40) as the expression. Use the directory integration's instance ID. Groups with that prefix can enter the claim as membership changes. Use the ID allowlist above if the set of eligible groups must stay fixed. See Okta's dynamic group allowlist guide.

Save the app settings. See Okta's groups claim guide for the Org Authorization Server. After deploying the scopes configuration in step 5, sign in with a fresh session. Send the access token as a Bearer credential to the discovered UserInfo endpoint (typically GET /oauth2/v1/userinfo). Verify that the response contains the expected groups string array. GreptimeDB maps only the groups value from this UserInfo response.

3. Create the GreptimeDB Roles​

Use an existing GreptimeDB administrator to create the roles in the catalog where the mapped users will connect. For this example, use the greptime catalog with two existing tables in the public database:

Okta groupRole nameAccess
greptimedb-alpha-readersalpha_readerSELECT on public.alpha_metrics
greptimedb-beta-readersbeta_readerSELECT on public.beta_metrics

Send POST /v1/roles with an operation list and a table ACL. Replace the server URL and admin username in this example. curl prompts for the admin password.

curl --include --user '<admin-user>' \
'https://greptimedb.example.com/v1/roles?db=greptime-public' \
--header 'Content-Type: application/json' \
--data '{
"name": "alpha_reader",
"allowed_ops": ["sql.select"],
"acl_map": {
"public": [{"type": "match", "table": "alpha_metrics"}]
}
}'

Repeat with beta_reader and beta_metrics. Each successful request returns 201 Created and the role definition. Check the returned catalog, allowed_ops, and acl_map, and record the role id for verification. The mapping file uses role names; the current-user endpoint reports role IDs.

An Enterprise Dashboard with role management lists the created roles and the built-in __ops_* system roles on the Role Management page. The Dashboard's role editor changes a role's allowed operations and keeps its existing table ACLs, so create the ACLs through the role API as shown above.

Enterprise Dashboard Role Management page with two custom SELECT-only roles and built-in system roles

4. Write the Group-to-Role Mapping​

Save this file as group-roles.json:

{
"catalog": "greptime",
"mapping_field": "groups",
"roles": {
"greptimedb-alpha-readers": "alpha_reader",
"greptimedb-beta-readers": "beta_reader"
}
}
  • catalog is the catalog where GreptimeDB looks up roles. It defaults to greptime. Non-admin users must connect to this catalog and a database allowed by the mapped roles.
  • mapping_field is the exact top-level UserInfo field name. The field's value can be a string or an array of strings.
  • roles is a non-empty object. Each key matches an Okta claim value exactly, including case. Each value names a role in the configured catalog. When several groups match, GreptimeDB deduplicates the roles (up to 64) and merges their operation grants and ACLs separately. An operation granted by one role can apply to a table added by another. Review the combined grants for users with multiple roles.
  • An optional "*" entry supplies a fallback role only when no explicit group matches. It also applies if the claim is missing, null, or an empty array. A claim with an invalid type is rejected. This example omits the fallback, so a user with no matching group is denied.

Use scoped custom roles for ordinary access. The target admin selects the built-in administrator role and grants full privileges; role:admin refers to a custom role literally named admin.

The mapping must be a readable regular file of at most 64 KiB. Use strict JSON: the parser rejects unknown fields and duplicate group keys. Limit who can change the file, because it controls which roles an Okta user receives.

5. Configure GreptimeDB and the Dashboard​

Merge the following into the standalone or Frontend TOML configuration. Place user_provider at the top level before any table. If the enterprise user provider is already configured, keep its existing setting. Add the jwt_auth options to a single plugin entry and replace the issuer and client ID:

user_provider = "greptime_ee_user_provider:"

[[plugins]]
[plugins.jwt_auth]
issuer = "https://your-org.okta.com"
client_id = "your-oidc-app-client-id"
introspection_client_id_location = "query"
scopes = ["openid", "profile", "email", "groups"]
display_name = "Okta"
group_role_mapping_file = "/etc/greptimedb/sso/group-roles.json"

introspection_client_id_location = "query" sends client_id in the URL query for Okta's public-client introspection. Omit secret, public_key, jwks_url, audience, algorithm, and other JWKS settings for remote OIDC. Leave auto_provision and its privilege and database lists unset: group mapping and automatic user provisioning exclude each other, and the Frontend fails to start when a configuration combines them.

The Dashboard uses scopes in the OIDC authorization request. Include openid and groups, and keep profile for the default UserInfo display name, preferred_username. Okta must grant the groups scope and return the claim according to the app's Group Claims settings.

Serve the Dashboard over HTTPS. Allow the browser to reach Okta's discovery document (<issuer>/.well-known/openid-configuration), authorization endpoint, and token endpoint. Allow GreptimeDB to reach discovery, introspection, and UserInfo over trusted HTTPS. If you use dashboard-apiserver, point the instance at the configured Frontend and set enableUserAuthentication: true in the dashboard-apiserver configuration.

Mount the Mapping on Kubernetes​

Create a ConfigMap in the cluster's namespace. Set NAMESPACE to that namespace before running this command from the directory containing group-roles.json:

kubectl -n "$NAMESPACE" create configmap okta-role-mapping \
--from-file=group-roles.json=./group-roles.json

For the Enterprise Helm deployment, merge the TOML into frontend.configData. If the deployment sets frontend.configFile, put the TOML in that file; the chart then builds the Frontend configuration from configFile alone. If auth.enabled is set, verify that auth.useBuiltIn: true selects the Enterprise user provider. Add the mount to the existing Helm values, preserving other volumes and mounts:

frontend:
podTemplate:
volumes:
- name: sso-group-roles
configMap:
name: okta-role-mapping
main:
volumeMounts:
- name: sso-group-roles
mountPath: /etc/greptimedb/sso
readOnly: true

If you manage GreptimeDBCluster directly, use spec.frontend.config for the TOML and spec.frontend.template for the volumes and mounts. For deployments with named Frontend groups, configure config and template on each serving group.

Mount the directory as shown so its files follow ConfigMap updates. A subPath mount of the single file keeps the content from container start until the pod restarts. For a deployment outside Kubernetes, place the JSON at the configured path and give the GreptimeDB process read access.

Roll Out and Update the Mapping​

Apply the Helm or GreptimeDBCluster changes and wait for all serving Frontends to be ready. Outside Kubernetes, restart the configured processes.

GreptimeDB checks the mapping file during startup, fails to start when the file is unreadable or invalid, and reads the file again on each SSO authentication. To change the rules, update the ConfigMap or atomically replace the file at the same path. A new Bearer-authenticated HTTP request or SQL connection uses the updated rules once the change reaches its server. ConfigMap projection takes time, so check the file on every replica. If the ConfigMap is immutable, create a new one and roll out the updated volume reference. Existing SQL connections keep their session permissions; close those connections if you need immediate revocation. Changing the TOML or mapping path requires a restart.

6. Verify and Troubleshoot​

  1. Check GET /v1/auth/config directly or through the Dashboard proxy. Confirm auth_required: true and that the oidc method advertises your issuer, client ID, and groups scope.
  2. Use a fresh browser session for each test user. Sign in with Okta and check GET /v1/users/current?db=greptime-public. The response should have auth_source: "sso" and the expected role_ids from step 3.
  3. In the public database, run SELECT * FROM public.alpha_metrics LIMIT 1 and SELECT * FROM public.beta_metrics LIMIT 1 separately. For a user in just one group, the corresponding query should succeed and the other should be denied (403 over HTTP).
  4. Try an app-assigned user with no matching group. With no "*" rule, that user's Bearer requests should be rejected (401 over HTTP).
  5. To test a mapping update, change one rule in a test environment. Once the new file has reached the Frontends, repeat the HTTP checks with the same unexpired token. Verify the new role IDs and SQL results, then restore the original mapping.

At startup, the Frontend log Bearer authentication configured should show verification="oidc_introspection" and identity_resolution="group_role_mapping". For troubleshooting, temporarily set [logging] level to "info,user_server=debug" on the affected server. If Helm manages logging, add user_server=debug to frontend.logging.filters. Use the following stages to find the failing check:

Symptom or log stageWhat to check
Only password login appearsCheck dashboard-apiserver's enableUserAuthentication setting, the instance's Frontend address, and the raw /v1/auth/config response.
introspection or userinfoCheck issuer, client ID, query placement, HTTPS connectivity, and that the access token is valid. UserInfo must include sub and the configured display-name claim.
group_mapping_fileCheck the actual file path and mount on the serving Frontend, file permissions, size, and JSON syntax.
group_selectionCheck the app assignment, actual group membership, granted scope, UserInfo claim type, and exact group names. Sign in again after changing group claim settings.
role_lookupConfirm the mapped role names exist in the specified catalog.
/v1/users/current succeeds but a query is deniedCheck the role's operation grants and database/table ACLs for that query.
Different replicas return different permissionsCheck that all Frontends have the same configuration and have received the updated file.

Restore the normal log level after troubleshooting. Remove access tokens, ID tokens, passwords, and OAuth callback URLs before sharing logs or filing a support request.