This document outlines the configuration options for setting up authentication Anduin:
- Auth Gateway
- Keycloak
- Superset with Remote User Auth
- CaskFs with Remote User Auth
- Dagster
- Superset with Keycloak Auth
- CaskFs with Keycloak Auth
- Dagster
Keycloak is an open-source identity and access management solution. It provides features such as single sign-on (SSO), user federation, and identity brokering. In the context of Anduin and the UC Davis Library, Keycloak is used as the primary identity provider for authentication.
The Auth Gateway is configured to use Keycloak as the identity provider. The following environment variables are used to set up the Auth Gateway:
OIDC_BASE_URL: The base URL of the Keycloak server (e.g.,https://keycloak.example.com/auth).OIDC_REALM_NAME: The Keycloak realm name.OIDC_CLIENT_ID: The client ID for the Auth Gateway application in Keycloak.OIDC_CLIENT_SECRET: The client secret for the Auth Gateway application in Keycloak.OIDC_ROLES_CLAIM_PATHS: The dot-separated path to the roles in the Keycloak token. e.g.,realm_access.roles. You can provide more than one path and all roles will be joined. Default isrolesandresource_access.anduin.roles.SUPERSET_REMOTE_AUTH: Set totrueto enable Superset remote user authentication via the Auth Gateway.OIDC_JWT_SECRET: The secret key used to sign JWT tokens for internal communication between the Auth Gateway and services like Superset and CaskFs.SESSION_SECRET: The secret key used to sign session cookies.
The Superset instance is configured to use remote user authentication via the Auth Gateway. The remote auth will looked at the x-anduin-user header for user object. The user object is a JSON string with the following structure:
{
"username": "user1",
"email": "user1@example.com",
"firstName": "User",
"lastName": "One",
"roles": ["dashboard", "dashboard-admin"]
}The following environment variables are used to set up Superset with remote user auth:
SUPERSET_REMOTE_USER_AUTH: Set totrueto enable remote user authentication.
The Superset instance is configured with the option to use Keycloak for authentication. The following environment variables are used to set up Superset with Keycloak:
SUPERSET_KEYCLOAK_AUTH: Set totrueto enable Keycloak authentication.KEYCLOAK_CLIENT_ID: The client ID for the Superset application in Keycloak.KEYCLOAK_CLIENT_SECRET: The client secret for the Superset application in Keycloak.KEYCLOAK_REALM_NAME: The Keycloak realm name.KEYCLOAK_HOST: The Keycloak authentication URL.KEYCLOAK_ADMIN_ROLE: The Keycloak role that maps to the Superset Admin role. Default isadmin.KEYCLOAK_DASHBOARD_ADMIN_ROLE: The Keycloak role that maps to the Superset Admin role. Default isdashboard-admin.KEYCLOAK_ALPHA_ROLE: The Keycloak role that maps to the Superset Alpha role. Default isdashboard.KEYCLOAK_PUBLIC_ROLE: The Keycloak role that maps to the Superset Public role. Default ispublic.KEYCLOAK_ROLE_DOT_PATH: The dot-separated path to the roles in the Keycloak token. e.g.,realm_access.roles. Default isroles.
The CaskFs instance is configured with the option to use Keycloak for authentication. See CaskFs documentation for details.
Dagster is configured to run behind the Auth Gateway. There is no direct authentication or authorization configured for Dagster itself. Access control is managed by the Auth Gateway. To access Dagster features, users must have the execute or admin role assigned to them in Keycloak.
GET /auth/login accepts three optional params, forwarded through the Keycloak round trip via returnTo and read back by /auth/success:
headless=true— skip the normalredirectbehavior and hand back a session token instead of sending the browser to the app.port— a loopback port. When present,/auth/successredirects the browser tohttp://127.0.0.1:<port>/callback?token=...&state=...&user=...instead of rendering anything, so a local CLI server can capture the token directly (see argonath'sdigtk auth login).state— an opaque value the caller generated and expects echoed back on the loopback callback, for CSRF protection. Not the OIDC protocol's ownstate— this one is app-level and round-trips throughreturnTounmodified.
Without port, the headless=true case instead renders client/headless.html with the token shown for manual copy/paste (e.g. a login initiated on a machine with no local browser).
The token handed to headless/CLI clients is the gateway's own session id (the anduin-sid cookie value), not a JWT — the gateway never gives out the underlying Keycloak token. A client presents it back as Authorization: Bearer <token>; setUser() in controllers/auth.js looks it up via store.get(token), the same session store a browser's cookie would resolve against. Downstream services (CaskFS, etc.) never see this token either — they only ever see the gateway's verified x-anduin-user header.