Skip to content

Commit a7191fa

Browse files
committed
feat: add groups_claim support to oidc-auth plugin
Support custom JWT claim-to-groups mapping via groups_claim config. This allows applications with their own role system (e.g. roles stored in the app database, not IdP scopes) to leverage gateway-level ACL. When groups_claim is set, x-auth-consumer-groups is populated from the specified claim instead of the scope claim. Supports JSON Pointer (RFC 6901) for nested claims like /realm_access/roles (Keycloak). Optional groups_claim_separator handles string-valued claims.
1 parent 34ff3ff commit a7191fa

3 files changed

Lines changed: 250 additions & 11 deletions

File tree

docs/rulesets/functions/barbacane-validate-middleware-config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,8 @@ const schemas = {
167167
jwks_refresh_seconds: { type: "integer", minimum: 10 },
168168
timeout: { type: "number", minimum: 0 },
169169
allow_query_token: { type: "boolean" },
170+
groups_claim: { type: "string" },
171+
groups_claim_separator: { type: "string" },
170172
},
171173
additionalProperties: false,
172174
},

plugins/oidc-auth/config-schema.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@
4646
"type": "boolean",
4747
"description": "Allow token extraction from the access_token query parameter (RFC 6750 §2.3). Disabled by default — tokens in URLs risk leaking via logs and referer headers.",
4848
"default": false
49+
},
50+
"groups_claim": {
51+
"type": "string",
52+
"description": "JWT claim to extract consumer groups from, replacing scope-based groups. Supports JSON Pointer (RFC 6901) for nested claims (e.g., \"/realm_access/roles\"). A plain name like \"roles\" is treated as \"/roles\"."
53+
},
54+
"groups_claim_separator": {
55+
"type": "string",
56+
"description": "Separator for splitting a string-valued groups claim into multiple groups. Only used when the claim value is a string, not a JSON array. If omitted, a string claim is treated as a single group."
4957
}
5058
},
5159
"additionalProperties": false

0 commit comments

Comments
 (0)