Phase 9: External OIDC Authentication (Optional)
By default, MaaS authenticates users via OpenShift tokens (TokenReview). External OIDC lets you integrate with identity providers like Keycloak, Okta, or Azure AD so users can access MaaS with their corporate credentials - no OpenShift accounts needed.
All file paths and oc apply commands in this guide are relative to the CAI-Field-Manual-MaaS repository root. Make sure you have cloned it and are working from its root directory (see Getting Started).
How It Works
MaaS uses a two-tier authentication model with external OIDC:
Platform API access - Users get an OIDC token from the identity provider and use it as a Bearer token to call the MaaS API (list models, create API keys, manage subscriptions).
Model inference - Users create an API key through the MaaS API using their OIDC token. The API key is then used for inference requests (
/v1/chat/completions). API keys capture the user’s group memberships at creation time.
Group-based access control works through OIDC token claims:
- The OIDC provider defines user groups (e.g.,
data-scientists,ml-engineers) - The OIDC token includes a
groupsclaim with the user’s group memberships - MaaS subscriptions and authorization policies reference these group names
- MaaS validates group memberships directly from the OIDC token - no OpenShift group sync needed
Group names in MaaS subscriptions must match the group names in the OIDC token groups claim exactly.
When using external OIDC, users create API keys through the MaaS API using curl or other HTTP clients. The Red Hat OpenShift AI dashboard uses OpenShift OAuth and does not support API key creation for external OIDC users.
Automated Setup
To deploy Keycloak, configure OIDC, and run verification in one go:
To tear everything down:
The rest of this page walks through each step manually.
Step 1: Deploy Keycloak
This section deploys Red Hat Build of Keycloak (RHBK) as the OIDC provider. If you already have an external identity provider, skip to Step 3.
Install the RHBK operator
Wait for the operator to install:
Deploy Keycloak and PostgreSQL
This creates:
- A PostgreSQL database for Keycloak storage
- A Keycloak instance connected to PostgreSQL
- A
KeycloakRealmImportthat creates themaasrealm with test users and groups
Set the Keycloak hostname. Without it, the RHBK operator creates a host-less Ingress that OpenShift cannot convert into a Route, and Step 2 will find no route:
Wait for Keycloak to be ready:
The READY column should show True. Then check the realm import:
Should return True.
Step 2: Discover the Keycloak Issuer URL
Get the Keycloak route hostname and construct the issuer URL:
Verify the OIDC discovery endpoint is accessible:
You should see a JSON document with issuer, authorization_endpoint, token_endpoint, and other OIDC metadata.
Test users and groups
The imported realm includes two test users:
| Username | Password | Groups |
|---|---|---|
maas-user | maas-user | data-scientists, ml-engineers |
restricted-user | restricted-user | data-scientists |
You can verify the groups claim by getting a token:
Expected output:
Step 3: Configure MaaS for External OIDC
Patch the MaaS tenant resource with the OIDC provider configuration:
Verify the patch was applied:
Expected output:
The fields:
clientId- The Keycloak client ID registered for MaaS (maas-oidc)issuerUrl- The OIDC issuer URL. MaaS fetches JWKS keys from<issuerUrl>/.well-known/openid-configurationto verify token signaturesttl- How long (seconds) MaaS caches the OIDC provider’s signing keys before refreshing (default: 300, minimum: 30)
Verify the patch was applied:
Expected output:
Step 4: Create Subscriptions for OIDC Groups
MaaS subscriptions control which groups can access which models and at what rate limits. Create subscriptions that reference the OIDC group names:
This creates:
- Two
MaaSSubscriptionresources targeting thedata-scientistsandml-engineersgroups - Two
MaaSAuthPolicyresources granting those groups access to the simulator model
The group names in subscriptions (data-scientists, ml-engineers) must match exactly the group names in the OIDC token groups claim. MaaS validates group memberships directly from the token without any OpenShift group sync.
Verify the resources were created:
You should see the OIDC subscriptions and auth policies alongside any existing ones.
If you have models other than the simulator deployed, you can edit the subscription and auth policy manifests to reference your model names and namespaces before applying.
Step 5: Verify External OIDC
Automated verification
Expected output:
Manual verification
Get an OIDC token
List available models
If authentication is successful, the API returns a list of models available to the groups in your token. An empty list means the token is valid but the user’s groups have no matching subscriptions.
Create an API key
API keys capture the user’s group memberships at the time of creation. If a user is removed from a group in Keycloak, their existing API keys retain the original group associations until they expire or are manually revoked.
Run inference with the API key
Get the model ID from /v1/models and send a chat completion:
See the OIDC Authentication demo for a presenter-ready walkthrough with a click-through UI and CLI client. The JWKS Cache demo proves that JWT signatures are verified locally from cached keys. All demos are listed on the Demos page.
Cleanup
To remove the OIDC configuration and Keycloak:
Or manually:
After removing the OIDC configuration, MaaS falls back to the default OpenShift TokenReview authentication. Existing API keys created by OIDC users will stop working once revoked or expired.
Bring Your Own Identity Provider
If you have an existing OIDC provider (Okta, Azure AD, etc.) instead of Keycloak, you only need:
- A public (or confidential) OIDC client registered for MaaS
- The client configured to include the
groupsclaim in ID/access tokens - User groups that map to MaaS subscription group names
Skip Steps 1-2 and go directly to Step 3, replacing the clientId and issuerUrl with your provider’s values.