Auth: Add IsClientEnabled and IsEnabled for the authn.Service and authn.Client interfaces (#86034)

* Add `Service. IsClientEnabled` and `Client.IsEnabled` functions

* Implement `IsEnabled` function for authn clients

* Implement `IsClientEnabled` function for authn services
This commit is contained in:
linoman
2024-04-15 10:54:50 +02:00
committed by GitHub
parent 2b62167842
commit 51da96d94e
19 changed files with 140 additions and 5 deletions
+15
View File
@@ -94,6 +94,19 @@ type Service interface {
// RegisterClient will register a new authn.Client that can be used for authentication
RegisterClient(c Client)
// IsClientEnabled returns true if the client is enabled.
//
// The client lookup follows the same formats used by the `authn` package
// constants.
//
// For OAuth clients, use the `authn.ClientWithPrefix(name)` to get the provider
// name. Append the prefix `auth.client.{providerName}`.
//
// Example:
// - "saml" = "auth.client.saml"
// - "github" = "auth.client.github"
IsClientEnabled(client string) bool
}
type IdentitySynchronizer interface {
@@ -105,6 +118,8 @@ type Client interface {
Name() string
// Authenticate performs the authentication for the request
Authenticate(ctx context.Context, r *Request) (*Identity, error)
// IsEnabled returns the enabled status of the client
IsEnabled() bool
}
// ContextAwareClient is an optional interface that auth client can implement.