local

package
v1.3.11-0...-37b438a Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authenticator

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

Authenticator represents database connector.

func NewAuthenticator

func NewAuthenticator() *Authenticator

NewAuthenticator returns an instance of Authenticator.

func (*Authenticator) AddMfaToken

func (sa *Authenticator) AddMfaToken(opts map[string]interface{}) error

AddMfaToken adds MFA token to a user.

func (*Authenticator) AddPublicKey

func (sa *Authenticator) AddPublicKey(opts map[string]interface{}) error

AddPublicKey adds public key, e.g. GPG or SSH, for a user.

func (*Authenticator) AuthenticateUser

func (sa *Authenticator) AuthenticateUser(userInput, password string) (*jwtclaims.UserClaims, int, error)

AuthenticateUser checks the database for the presence of a username/email and password and returns user claims.

func (*Authenticator) ChangePassword

func (sa *Authenticator) ChangePassword(opts map[string]interface{}) error

ChangePassword changes password for a user.

func (*Authenticator) Configure

func (sa *Authenticator) Configure() error

Configure check database connectivity and required tables.

func (*Authenticator) CreateUser

func (sa *Authenticator) CreateUser(userName, userPwd, userEmail string, userClaims map[string]interface{}) error

CreateUser creates a user in a database

func (*Authenticator) DeleteMfaToken

func (sa *Authenticator) DeleteMfaToken(opts map[string]interface{}) error

DeleteMfaToken removes MFA token associated with the user.

func (*Authenticator) DeletePublicKey

func (sa *Authenticator) DeletePublicKey(opts map[string]interface{}) error

DeletePublicKey removes a public key, e.g. GPG or SSH, associated with the user.

func (*Authenticator) GetMfaTokens

func (sa *Authenticator) GetMfaTokens(opts map[string]interface{}) ([]*identity.MfaToken, error)

GetMfaTokens returns a list of MFA token associated with a user.

func (*Authenticator) GetPublicKeys

func (sa *Authenticator) GetPublicKeys(opts map[string]interface{}) ([]*identity.PublicKey, error)

GetPublicKeys returns a list of public keys associated with a user.

func (*Authenticator) SetPath

func (sa *Authenticator) SetPath(s string)

SetPath sets database path.

type Backend

type Backend struct {
	Name          string                       `json:"name,omitempty"`
	Method        string                       `json:"method,omitempty"`
	Realm         string                       `json:"realm,omitempty"`
	Path          string                       `json:"path,omitempty"`
	TokenProvider *jwtconfig.CommonTokenConfig `json:"-"`
	Authenticator *Authenticator               `json:"-"`
	// contains filtered or unexported fields
}

Backend represents authentication provider with local backend.

func NewDatabaseBackend

func NewDatabaseBackend() *Backend

NewDatabaseBackend return an instance of authentication provider with local backend.

func (*Backend) Authenticate

func (b *Backend) Authenticate(opts map[string]interface{}) (map[string]interface{}, error)

Authenticate performs authentication.

func (*Backend) ConfigureAuthenticator

func (b *Backend) ConfigureAuthenticator() error

ConfigureAuthenticator configures backend.

func (*Backend) ConfigureLogger

func (b *Backend) ConfigureLogger(logger *zap.Logger) error

ConfigureLogger configures backend with the same logger as its user.

func (*Backend) ConfigureTokenProvider

func (b *Backend) ConfigureTokenProvider(upstream *jwtconfig.CommonTokenConfig) error

ConfigureTokenProvider configures TokenProvider.

func (*Backend) Do

func (b *Backend) Do(opts map[string]interface{}) error

Do performs the requested operation.

func (*Backend) GetMethod

func (b *Backend) GetMethod() string

GetMethod returns the authentication method associated with this backend.

func (*Backend) GetMfaTokens

func (b *Backend) GetMfaTokens(opts map[string]interface{}) ([]*identity.MfaToken, error)

GetMfaTokens return a list of MFA tokens associated with a user.

func (*Backend) GetName

func (b *Backend) GetName() string

GetName return the name associated with this backend.

func (*Backend) GetPublicKeys

func (b *Backend) GetPublicKeys(opts map[string]interface{}) ([]*identity.PublicKey, error)

GetPublicKeys return a list of public keys associated with a user.

func (*Backend) GetRealm

func (b *Backend) GetRealm() string

GetRealm return authentication realm.

func (*Backend) Validate

func (b *Backend) Validate() error

Validate checks whether Backend is functional.

func (*Backend) ValidateConfig

func (b *Backend) ValidateConfig() error

ValidateConfig checks whether Backend has mandatory configuration.

Jump to

Keyboard shortcuts

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