feat(auth): add superadmin support for OAuth clients
CI / build-and-test (push) Successful in 2m46s

* Introduce Superadmin field in OAuthClient configuration
* Implement IsSuperadmin method in OAuthRegistry
* Update identityAdmin to check superadmin status via OAuthRegistry
* Add tests for OAuthRegistry superadmin functionality
This commit is contained in:
2026-07-20 23:19:51 +02:00
parent 196b543bee
commit d7c0205c50
6 changed files with 52 additions and 7 deletions
+15
View File
@@ -31,3 +31,18 @@ func (o *OAuthRegistry) Lookup(clientID string, clientSecret string) (string, bo
}
return "", false
}
// IsSuperadmin reports whether keyID (as returned by Lookup) belongs to an
// OAuth client configured with superadmin: true.
func (o *OAuthRegistry) IsSuperadmin(keyID string) bool {
for _, client := range o.clients {
id := client.ID
if id == "" {
id = client.ClientID
}
if id == keyID {
return client.Superadmin
}
}
return false
}