Documentation
¶
Overview ¶
Package auth defines a universal authentication manager
Index ¶
- type FallbackAuthenticator
- type RelyAuthConfig
- type RelyAuthDefinition
- type RelyAuthManager
- func (am *RelyAuthManager) Authenticate(ctx context.Context, body *authmode.AuthenticateRequestData) (authmode.AuthenticatedOutput, error)
- func (am *RelyAuthManager) Authenticator() *FallbackAuthenticator
- func (am *RelyAuthManager) Close() error
- func (am *RelyAuthManager) Settings() *authmode.RelyAuthSettings
- type RelyAuthMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FallbackAuthenticator ¶ added in v0.0.3
type FallbackAuthenticator struct {
Authenticators []authmode.RelyAuthenticator
CustomAttributes []attribute.KeyValue
}
FallbackAuthenticator represents an authenticator that receives a list of authenticators and authenticates fallback in order.
func NewComposedAuthenticator ¶
func NewComposedAuthenticator(authenticators []authmode.RelyAuthenticator) *FallbackAuthenticator
NewComposedAuthenticator creates a new [ComposedAuthenticator] instance.
func (*FallbackAuthenticator) Authenticate ¶ added in v0.0.3
func (a *FallbackAuthenticator) Authenticate( ctx context.Context, body *authmode.AuthenticateRequestData, ) (authmode.AuthenticatedOutput, error)
Authenticate validates and authenticates the token from the auth webhook request.
func (*FallbackAuthenticator) Close ¶ added in v0.0.3
func (a *FallbackAuthenticator) Close() error
Close terminates all underlying authenticator resources.
func (*FallbackAuthenticator) IDs ¶ added in v0.0.3
func (a *FallbackAuthenticator) IDs() []string
IDs returns identities of this authenticator.
func (*FallbackAuthenticator) Mode ¶ added in v0.0.3
func (*FallbackAuthenticator) Mode() authmode.AuthMode
Mode returns the auth mode of the current authenticator.
type RelyAuthConfig ¶
type RelyAuthConfig struct {
// Version of the authentication config.
Version string `json:"version" yaml:"version" jsonschema:"enum=v1"`
// Kind of the resource which is always RelyAuth.
Kind string `json:"kind" yaml:"kind" jsonschema:"enum=RelyAuth"`
// List of authenticator configurations.
Definition RelyAuthDefinition `json:"definition" yaml:"definition"`
}
RelyAuthConfig is the data structure for authentication configurations.
func (RelyAuthConfig) Validate ¶
func (rac RelyAuthConfig) Validate() error
Validate checks if the configuration is valid.
type RelyAuthDefinition ¶
type RelyAuthDefinition struct {
// Global settings of the auth config.
Settings *authmode.RelyAuthSettings `json:"settings,omitempty" yaml:"settings,omitempty"`
// List of authenticator modes.
Modes []RelyAuthMode `json:"modes" yaml:"modes"`
}
RelyAuthDefinition defines authentication modes and settings.
type RelyAuthManager ¶
type RelyAuthManager struct {
// contains filtered or unexported fields
}
RelyAuthManager manages multiple authentication strategies to verify HTTP requests.
func NewRelyAuthManager ¶
func NewRelyAuthManager( ctx context.Context, config *RelyAuthConfig, options ...authmode.RelyAuthenticatorOption, ) (*RelyAuthManager, error)
NewRelyAuthManager creates a new RelyAuthManager instance from config.
func (*RelyAuthManager) Authenticate ¶
func (am *RelyAuthManager) Authenticate( ctx context.Context, body *authmode.AuthenticateRequestData, ) (authmode.AuthenticatedOutput, error)
Authenticate validates and authenticates the token from the auth webhook request.
func (*RelyAuthManager) Authenticator ¶
func (am *RelyAuthManager) Authenticator() *FallbackAuthenticator
Authenticator returns the internal [ComposedAuthenticator] instance.
func (*RelyAuthManager) Close ¶
func (am *RelyAuthManager) Close() error
Close terminates all underlying authenticator resources.
func (*RelyAuthManager) Settings ¶
func (am *RelyAuthManager) Settings() *authmode.RelyAuthSettings
Settings return settings of the manager.
type RelyAuthMode ¶ added in v0.0.3
type RelyAuthMode struct {
authmode.RelyAuthModeInterface `yaml:",inline"`
// Configurations for extra security rules.
SecurityRules *authmode.RelyAuthSecurityRulesConfig `json:"securityRules,omitempty" yaml:"securityRules,omitempty"`
}
RelyAuthMode wraps authentication configurations for an auth mode.
func NewRelyAuthMode ¶ added in v0.0.3
func NewRelyAuthMode[T authmode.RelyAuthModeInterface](inner T) RelyAuthMode
NewRelyAuthMode creates a new RelyAuthMode instance.
func (RelyAuthMode) JSONSchema ¶ added in v0.0.3
func (RelyAuthMode) JSONSchema() *jsonschema.Schema
JSONSchema defines a custom definition for JSON schema.
func (*RelyAuthMode) UnmarshalJSON ¶ added in v0.0.3
func (j *RelyAuthMode) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler.
func (*RelyAuthMode) UnmarshalYAML ¶ added in v0.0.3
func (j *RelyAuthMode) UnmarshalYAML(value *yaml.Node) error
UnmarshalYAML implements the custom behavior for the yaml.Unmarshaler interface.
func (RelyAuthMode) Validate ¶ added in v0.0.3
func (j RelyAuthMode) Validate() error
Validate if the current instance is valid.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package apikey implements the API key auth mode.
|
Package apikey implements the API key auth mode. |
|
Package authmetrics defines global metrics and attributes for the auth service.
|
Package authmetrics defines global metrics and attributes for the auth service. |
|
Package authmode defines common types and utilities for auth modes.
|
Package authmode defines common types and utilities for auth modes. |
|
Package jwt implements the authenticator for the JWT auth mode
|
Package jwt implements the authenticator for the JWT auth mode |
|
Package noauth implements the noAuth mode.
|
Package noauth implements the noAuth mode. |
|
Package webhook implements the webhook auth mode
|
Package webhook implements the webhook auth mode |