authn

package
v1.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 24, 2022 License: Apache-2.0 Imports: 36 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessDeniedResponse

type AccessDeniedResponse struct {
	Error     bool   `json:"error,omitempty" xml:"error,omitempty" yaml:"error,omitempty"`
	Message   string `json:"message,omitempty" xml:"message,omitempty" yaml:"message,omitempty"`
	Timestamp string `json:"timestamp,omitempty" xml:"timestamp,omitempty" yaml:"timestamp,omitempty"`
}

AccessDeniedResponse is the access denied response.

type AuthRequest

type AuthRequest struct {
	Username string `json:"username,omitempty" xml:"username,omitempty" yaml:"username,omitempty"`
	Password string `json:"password,omitempty" xml:"password,omitempty" yaml:"password,omitempty"`
	Realm    string `json:"realm,omitempty" xml:"realm,omitempty" yaml:"realm,omitempty"`
}

AuthRequest is authentication request.

type AuthResponse

type AuthResponse struct {
	Token     string `json:"token,omitempty" xml:"token,omitempty" yaml:"token,omitempty"`
	TokenName string `json:"token_name,omitempty" xml:"token_name,omitempty" yaml:"token_name,omitempty"`
}

AuthResponse is the response to authentication request.

type Authenticator

type Authenticator struct {
	Path       string `json:"path,omitempty" xml:"path,omitempty" yaml:"path,omitempty"`
	PortalName string `json:"portal_name,omitempty" xml:"portal_name,omitempty" yaml:"portal_name,omitempty"`
	// contains filtered or unexported fields
}

Authenticator is an authentication endpoint.

func (*Authenticator) Provision

func (m *Authenticator) Provision(logger *zap.Logger) error

Provision configures the instance of Authenticator.

func (*Authenticator) ServeHTTP

ServeHTTP is a gateway for the authentication portal.

func (*Authenticator) Validate

func (m *Authenticator) Validate() error

Validate validates the provisioning.

type Portal

type Portal struct {
	// contains filtered or unexported fields
}

Portal is an authentication portal.

func NewPortal

func NewPortal(cfg *PortalConfig, logger *zap.Logger) (*Portal, error)

NewPortal returns an instance of Portal.

func (*Portal) APIKeyAuth

func (p *Portal) APIKeyAuth(r *idp.ProviderRequest) error

APIKeyAuth performs API key authentication.

func (*Portal) BasicAuth

func (p *Portal) BasicAuth(r *idp.ProviderRequest) error

BasicAuth performs API key authentication.

func (*Portal) Register

func (p *Portal) Register() error

Register registers the Portal with PortalRegistry.

func (*Portal) ServeHTTP

func (p *Portal) ServeHTTP(ctx context.Context, w http.ResponseWriter, r *http.Request, rr *requests.Request) error

ServeHTTP is a gateway for the authentication portal.

type PortalConfig

type PortalConfig struct {
	Name string `json:"name,omitempty" xml:"name,omitempty" yaml:"name,omitempty"`
	// UI holds the configuration for the user interface.
	UI *ui.Parameters `json:"ui,omitempty" xml:"ui,omitempty" yaml:"ui,omitempty"`
	// UserRegistrationConfig holds the configuration for the user registration.
	UserRegistrationConfig *registration.Config `json:"user_registration_config,omitempty" xml:"user_registration_config,omitempty" yaml:"user_registration_config,omitempty"`
	// UserTransformerConfig holds the configuration for the user transformer.
	UserTransformerConfigs []*transformer.Config `json:"user_transformer_configs,omitempty" xml:"user_transformer_configs,omitempty" yaml:"user_transformer_configs,omitempty"`
	// CookieConfig holds the configuration for the cookies issues by Authenticator.
	CookieConfig *cookie.Config `json:"cookie_config,omitempty" xml:"cookie_config,omitempty" yaml:"cookie_config,omitempty"`
	// BackendConfigs hold the configurations for authentication backends.
	BackendConfigs []backends.Config `json:"backend_configs,omitempty" xml:"backend_configs,omitempty" yaml:"backend_configs,omitempty"`
	// AccessListConfigs hold the configurations for the ACL of the token validator.
	AccessListConfigs []*acl.RuleConfiguration `json:"access_list_configs,omitempty" xml:"access_list_configs,omitempty" yaml:"access_list_configs,omitempty"`
	// TokenValidatorOptions holds the configuration for the token validator.
	TokenValidatorOptions *options.TokenValidatorOptions `json:"token_validator_options,omitempty" xml:"token_validator_options,omitempty" yaml:"token_validator_options,omitempty"`
	// CryptoKeyConfigs hold the configurations for the keys used to issue and validate user tokens.
	CryptoKeyConfigs []*kms.CryptoKeyConfig `json:"crypto_key_configs,omitempty" xml:"crypto_key_configs,omitempty" yaml:"crypto_key_configs,omitempty"`
	// CryptoKeyStoreConfig hold the default configuration for the keys, e.g. token name and lifetime.
	CryptoKeyStoreConfig map[string]interface{} `json:"crypto_key_store_config,omitempty" xml:"crypto_key_store_config,omitempty" yaml:"crypto_key_store_config,omitempty"`
	// TokenGrantorOptions holds the configuration for the tokens issues by Authenticator.
	TokenGrantorOptions *options.TokenGrantorOptions `json:"token_grantor_options,omitempty" xml:"token_grantor_options,omitempty" yaml:"token_grantor_options,omitempty"`
	// contains filtered or unexported fields
}

PortalConfig TODO

func (*PortalConfig) AddRawCryptoConfigs

func (cfg *PortalConfig) AddRawCryptoConfigs(s string)

AddRawCryptoConfigs adds raw crypto configs.

func (*PortalConfig) Validate

func (cfg *PortalConfig) Validate() error

Validate validates PortalConfig.

type PortalRegistry

type PortalRegistry struct {
	// contains filtered or unexported fields
}

PortalRegistry is a registry of authentication portals.

func (*PortalRegistry) LookupPortal added in v1.0.6

func (r *PortalRegistry) LookupPortal(s string) (*Portal, error)

LookupPortal returns Portal entry from the PortalRegistry.

func (*PortalRegistry) RegisterAuthenticator added in v1.0.6

func (r *PortalRegistry) RegisterAuthenticator(a *Authenticator) error

RegisterAuthenticator registers Authenticator with the PortalRegistry.

func (*PortalRegistry) RegisterPortal added in v1.0.6

func (r *PortalRegistry) RegisterPortal(s string, p *Portal) error

RegisterPortal registers Portal with the PortalRegistry.

func (*PortalRegistry) UnregisterPortal added in v1.0.6

func (r *PortalRegistry) UnregisterPortal(s string)

UnregisterPortal unregisters Portal from the PortalRegistry.

Directories

Path Synopsis
enums

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL