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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user