fix: check scope claim for client_credentials JWT auth #27

Closed
rock wants to merge 2 commits from fix/client-credentials-scope-auth into main
Showing only changes of commit db09d546e0 - Show all commits
+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
}