mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2026-08-31 00:47:15 +02:00
feat(auth): map OIDC token roles to CC roles via configurable mapping
OIDC roles were translated by a hardcoded switch that only recognised the literal names user/admin/manager/support (dropping api) and required the IdP to emit exactly those names. Add an optional auth.oidc.role-mapping (OIDC role/group claim value -> CC role) so operators can map their own realm/client role names, including api. The mapping is the sole source of roles: only mapped names are honored, unmapped token roles are ignored, and users without any mapped role receive the base "user" role. Mapping targets are validated once at startup. Role assignment stays authoritative on every login as before. Note: deployments relying on the IdP emitting literal CC role names must now map them explicitly (e.g. "admin": "admin"). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Entire-Checkpoint: 66451678484b
This commit is contained in:
@@ -76,6 +76,13 @@ var configSchema = `
|
||||
"client-secret": {
|
||||
"description": "OAuth2 client secret for the OIDC provider. Overridden by the OID_CLIENT_SECRET environment variable when set.",
|
||||
"type": "string"
|
||||
},
|
||||
"role-mapping": {
|
||||
"description": "Maps an OIDC role/group claim value (from realm_access/resource_access) to a CC role. Valid target roles: admin, support, api, manager, user. This is the sole source of roles: only mapped roles are honored, unmapped token roles are ignored (literal CC role names must be mapped explicitly). Users without any mapped role receive the base 'user' role.",
|
||||
"type": "object",
|
||||
"additionalProperties": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": ["provider"]
|
||||
|
||||
Reference in New Issue
Block a user