Single Sign-On

Provider setup:

  • a confidential client
  • redirect URI <CDM_PUBLIC_URL>/oidc, exact match including scheme and port
  • a groups claim in the userinfo response

CDM settings: Configuration Reference.

Roles

Role Can
viewer see all clusters, open support tickets
admin also add and remove clusters, change them, read task output and the audit trail, accept the licence agreement

Users get viewer unless OIDC_ROLE_MAPPING maps one of their groups to admin.

Example: authentik

  1. Applications → Providers → Create → OAuth2/OpenID Provider

    Field Value
    Name CDM
    Client type Confidential
    Redirect URIs https://cdm.example.com/oidc, Strict
    Signing Key your certificate (RS256)
  2. Applications → Applications → Create: name croit Datacenter Manager, slug cdm, the provider from step 1.

  3. Configure CDM:

    OIDC_DISCOVERY_URL=https://authentik.example.com/application/o/cdm/.well-known/openid-configuration
    OIDC_CLIENT_ID=<client ID>
    OIDC_CLIENT_SECRET=<client secret>
    OIDC_ROLE_MAPPING={"storage-admins":"admin"}
    

If your authentik version does not send groups in the profile scope, add a scope mapping under Customisation → Property Mappings → Create → Scope Mapping:

Field Value
Scope name groups
Expression return [group.name for group in user.ak_groups.all()]

Add it to the provider's scopes and set OIDC_SCOPES=openid email profile groups.

Checking the groups claim

CDM logs every sign-in (docker logs cdm):

INFO  mapped the provider's groups to CDM roles  user=martin  claim=groups  groups=[storage-admins]  roles=[admin]  defaulted=false
INFO  mapped the provider's groups to CDM roles  user=jo  claim=groups  groups=absent  roles=[viewer]  defaulted=true
INFO  mapped the provider's groups to CDM roles  user=ana  claim=groups  groups="present but empty"  roles=[viewer]  defaulted=true
INFO  mapped the provider's groups to CDM roles  user=kim  claim=groups  groups=[devs]  roles=[viewer]  defaulted=true
Log Fix
groups=absent Claim not sent. Under another name: set OIDC_GROUPS_CLAIM.
present but empty Claim is empty or not a list.
a group, but defaulted=true Group missing in OIDC_ROLE_MAPPING.

Role changes apply at the next sign-in.