auth

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRateLimitExceeded      = fmt.Errorf("auth rate limit exceeded")
	ErrIncorrectPassword      = fmt.Errorf("incorrect password")
	ErrAccountIsNotActive     = fmt.Errorf("account is not active")
	ErrUserNotExist           = fmt.Errorf("user not exist")
	ErrUserOrPasswordNotValid = fmt.Errorf("user or password not valid")
)

Functions

func NewTokenAuthenticator

func NewTokenAuthenticator(operator iam.Operator, managementInterface TokenManagementInterface) authenticator.Token

Types

type MFAAuthenticator

type MFAAuthenticator interface {
	Enabled() bool
	Providers(info user.Info) (UserMFAProviders, error)
	ProviderRequest(provider mfa.UserMFAProvider) error
	Authenticate(provider string, token string, req url.Values) (user.Info, error)
}

func NewMFAAuthenticator

func NewMFAAuthenticator(iamOperator iam.Operator, cache cache.Interface, opts *mfa.Options) MFAAuthenticator

type OAuthAuthenticator

type OAuthAuthenticator interface {
	Authenticate(provider string, req *http.Request) (user.Info, string, error)
}

func NewOauthAuthenticator

func NewOauthAuthenticator(operator iam.Operator, options *authoptions.AuthenticationOptions) OAuthAuthenticator

type PasswordAuthenticator

type PasswordAuthenticator interface {
	Authenticate(username, password string) (user.Info, string, error)
}

func NewPasswordAuthenticator

func NewPasswordAuthenticator(operator iam.Operator, options *authoptions.AuthenticationOptions) PasswordAuthenticator

type TokenManagementInterface

type TokenManagementInterface interface {
	// Verify verifies a token, and return a User if it's a valid token, otherwise return error
	Verify(token string) (user.Info, error)
	// IssueTo issues a token a User, return error if issuing process failed
	IssueTo(user user.Info) (*oauth.Token, error)
	// RevokeAllUserTokens revoke all user tokens
	RevokeAllUserTokens(username string) error
}

type UserMFAProviders

type UserMFAProviders struct {
	Providers []mfa.UserMFAProvider `json:"providers,omitempty"`
}

Jump to

Keyboard shortcuts

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