Documentation
¶
Overview ¶
Package apikey implements the API key auth mode.
Index ¶
- type APIKeyAuthenticator
- func (aka *APIKeyAuthenticator) Authenticate(_ context.Context, body *authmode.AuthenticateRequestData) (authmode.AuthenticatedOutput, error)
- func (*APIKeyAuthenticator) Close() error
- func (aka APIKeyAuthenticator) Equal(target APIKeyAuthenticator) bool
- func (aka *APIKeyAuthenticator) IDs() []string
- func (*APIKeyAuthenticator) Mode() authmode.AuthMode
- type RelyAuthAPIKeyConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIKeyAuthenticator ¶
type APIKeyAuthenticator struct {
// contains filtered or unexported fields
}
APIKeyAuthenticator implements the authenticator with API key.
func NewAPIKeyAuthenticator ¶
func NewAPIKeyAuthenticator( ctx context.Context, config *RelyAuthAPIKeyConfig, options authmode.RelyAuthenticatorOptions, ) (*APIKeyAuthenticator, error)
NewAPIKeyAuthenticator creates an API key authenticator instance.
func (*APIKeyAuthenticator) Authenticate ¶
func (aka *APIKeyAuthenticator) Authenticate( _ context.Context, body *authmode.AuthenticateRequestData, ) (authmode.AuthenticatedOutput, error)
Authenticate validates and authenticates the token from the auth webhook request.
func (*APIKeyAuthenticator) Close ¶
func (*APIKeyAuthenticator) Close() error
Close handles the resources cleaning.
func (APIKeyAuthenticator) Equal ¶
func (aka APIKeyAuthenticator) Equal(target APIKeyAuthenticator) bool
Equal checks if the target value is equal.
func (*APIKeyAuthenticator) IDs ¶ added in v0.0.2
func (aka *APIKeyAuthenticator) IDs() []string
IDs returns identities of this authenticator.
func (*APIKeyAuthenticator) Mode ¶
func (*APIKeyAuthenticator) Mode() authmode.AuthMode
Mode returns the auth mode of the current authenticator.
type RelyAuthAPIKeyConfig ¶
type RelyAuthAPIKeyConfig struct {
// Unique identity of the auth config.
// If not set, ID will be the index of the array.
ID string `json:"id,omitempty" yaml:"id,omitempty"`
// Authentication mode which is always apiKey.
Mode authmode.AuthMode `json:"mode" jsonschema:"enum=apiKey" yaml:"mode"`
// Brief description of the auth config.
Description string `json:"description,omitempty" yaml:"description,omitempty"`
// Source of the authentication token.
TokenLocation authscheme.TokenLocation `json:"tokenLocation" yaml:"tokenLocation"`
// Custom session variables for this auth mode.
SessionVariables map[string]goenvconf.EnvAny `json:"sessionVariables" yaml:"sessionVariables"`
// Value of the static API key to be compared.
Value goenvconf.EnvString `json:"value" yaml:"value"`
}
RelyAuthAPIKeyConfig contains configurations for HTTP authentication with static secrets.
func NewRelyAuthAPIKeyConfig ¶
func NewRelyAuthAPIKeyConfig( location authscheme.TokenLocation, value goenvconf.EnvString, sessionVariables map[string]goenvconf.EnvAny, ) *RelyAuthAPIKeyConfig
NewRelyAuthAPIKeyConfig creates a new APIKeyAuthConfig instance.
func (RelyAuthAPIKeyConfig) Equal ¶
func (j RelyAuthAPIKeyConfig) Equal(target RelyAuthAPIKeyConfig) bool
Equal checks if the target value is equal.
func (RelyAuthAPIKeyConfig) GetMode ¶
func (RelyAuthAPIKeyConfig) GetMode() authmode.AuthMode
GetMode returns the auth mode of the current config.
func (RelyAuthAPIKeyConfig) IsZero ¶
func (j RelyAuthAPIKeyConfig) IsZero() bool
IsZero if the current instance is empty.
func (RelyAuthAPIKeyConfig) Validate ¶
func (j RelyAuthAPIKeyConfig) Validate() error
Validate if the current instance is valid.