authn

package
v1.4.39 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2022 License: Apache-2.0 Imports: 35 Imported by: 1

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" yaml:"username,omitempty"`
	Password string `json:"password,omitempty" xml:"password" yaml:"password,omitempty"`
	Realm    string `json:"realm,omitempty" xml:"realm" 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 {
	Name string `json:"-"`
	// PrimaryInstance indicates, when it is set to true, the instance of the
	// portal is primary.
	PrimaryInstance bool `json:"primary,omitempty"`
	// Context is the context whether the portal operates.
	Context string `json:"context,omitempty"`
	// UI holds the configuration for the user interface.
	UI *ui.Parameters `json:"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_config,omitempty" xml:"user_transformer_config,omitempty" yaml:"user_transformer_config,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"`
	// AccessListConfigs hold the configurations for the ACL of the token validator.
	AccessListConfigs []*acl.RuleConfiguration `json:"access_list_configs,omitempty"`
	// TokenValidatorOptions holds the configuration for the token validator.
	TokenValidatorOptions *options.TokenValidatorOptions `json:"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"`
	// CryptoKeyStoreConfig hold the default configuration for the keys, e.g. token name and lifetime.
	CryptoKeyStoreConfig map[string]interface{} `json:"crypto_key_store_config,omitempty"`
	// TokenGrantorOptions holds the configuration for the tokens issues by Authenticator.
	TokenGrantorOptions *options.TokenGrantorOptions `json:"token_grantor_options,omitempty"`
	// contains filtered or unexported fields
}

Authenticator implements Form-Based, Basic, Local, LDAP, OpenID Connect, OAuth 2.0, SAML Authentication.

func (*Authenticator) APIKeyAuth added in v1.4.37

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

APIKeyAuth performs API key authentication.

func (*Authenticator) BasicAuth added in v1.4.37

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

BasicAuth performs API key authentication.

func (*Authenticator) Provision

func (m *Authenticator) Provision() error

Provision configures the instance of authentication portal.

func (*Authenticator) ServeHTTP

ServeHTTP is a gateway for the authentication portal.

func (*Authenticator) SetLogger

func (m *Authenticator) SetLogger(logger *zap.Logger)

SetLogger add logger to Authenticator.

func (*Authenticator) Validate

func (m *Authenticator) Validate() error

Validate validates the provisioning.

type InstanceManager

type InstanceManager struct {
	Members          map[string]*Authenticator
	PrimaryInstances map[string]*Authenticator
	MemberCount      map[string]int
	// contains filtered or unexported fields
}

InstanceManager provides access to all Authenticator instances.

var AuthManager *InstanceManager

AuthManager is the global authentication provider pool.

func NewInstanceManager

func NewInstanceManager() *InstanceManager

NewInstanceManager returns a new instance of InstanceManager.

func (*InstanceManager) Register

func (mgr *InstanceManager) Register(m *Authenticator) error

Register registers authentication provider instance with the pool.

func (*InstanceManager) Validate

func (mgr *InstanceManager) Validate(m *Authenticator) error

Validate validates the provisioning of an Authenticator instance.

type InstanceStatus

type InstanceStatus int

InstanceStatus is the state of an Instance.

const (
	// Unknown is indeterminate state.
	Unknown InstanceStatus = iota
	// BootstrapPrimary is primary instance is ready for bootstrapping.
	BootstrapPrimary
	// BootstrapSecondary is non-primary instance is ready for bootstrapping.
	BootstrapSecondary
	// DelaySecondary is non-primary instance is not ready for bootstrapping.
	DelaySecondary
	// DuplicatePrimary is a dumplicate primary instance.
	DuplicatePrimary
)

Jump to

Keyboard shortcuts

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