Author SHA1 Message Date
Admin Bot db09d546e0 fix: check scope claim for client_credentials JWT auth
CI / CI (pull_request) Successful in 3m11s
Authentik client_credentials tokens don't carry roles/permissions claims
(scope mappings not evaluated). Capabilities are carried as space-separated
scope values instead. Gateway now checks scope claim as fallback after
roles and permissions.
2026-09-14 08:18:15 +09:00
+14
View File
@@ -165,6 +165,20 @@ func (v *Validator) CheckPermissions(claims jwt.MapClaims, required ...string) b
} }
} }
// Fall back to scope claim (for client_credentials tokens)
// Authentik client_credentials tokens carry capabilities as space-separated scopes
if scopeIface, ok := claims["scope"]; ok {
if scopeStr, ok := scopeIface.(string); ok {
for _, s := range strings.Split(scopeStr, " ") {
for _, req := range required {
if s == req {
return true
}
}
}
}
}
return false return false
} }