local

package
v1.4.41 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2022 License: Apache-2.0 Imports: 8 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) AddAPIKey

func (sa *Authenticator) AddAPIKey(r *requests.Request) error

AddAPIKey adds API key for a user.

func (*Authenticator) AddMfaToken

func (sa *Authenticator) AddMfaToken(r *requests.Request) error

AddMfaToken adds MFA token to a user.

func (*Authenticator) AddPublicKey

func (sa *Authenticator) AddPublicKey(r *requests.Request) error

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

func (*Authenticator) AddUser

func (sa *Authenticator) AddUser(r *requests.Request) error

AddUser adds a user to database.

func (*Authenticator) AuthenticateUser

func (sa *Authenticator) AuthenticateUser(r *requests.Request) 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(r *requests.Request) error

ChangePassword changes password for a user.

func (*Authenticator) Configure

func (sa *Authenticator) Configure(fp string) error

Configure check database connectivity and required tables.

func (*Authenticator) DeleteAPIKey

func (sa *Authenticator) DeleteAPIKey(r *requests.Request) error

DeleteAPIKey removes API key associated with the user.

func (*Authenticator) DeleteMfaToken

func (sa *Authenticator) DeleteMfaToken(r *requests.Request) error

DeleteMfaToken removes MFA token associated with the user.

func (*Authenticator) DeletePublicKey

func (sa *Authenticator) DeletePublicKey(r *requests.Request) error

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

func (*Authenticator) DeleteUser

func (sa *Authenticator) DeleteUser(r *requests.Request) error

DeleteUser delete a specific user from database.

func (*Authenticator) GetAPIKeys

func (sa *Authenticator) GetAPIKeys(r *requests.Request) error

GetAPIKeys returns a list of API keys associated with a user.

func (*Authenticator) GetMfaTokens

func (sa *Authenticator) GetMfaTokens(r *requests.Request) error

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

func (*Authenticator) GetPublicKeys

func (sa *Authenticator) GetPublicKeys(r *requests.Request) error

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

func (*Authenticator) GetUser

func (sa *Authenticator) GetUser(r *requests.Request) error

GetUser retrieves a specific user from database.

func (*Authenticator) GetUsers

func (sa *Authenticator) GetUsers(r *requests.Request) error

GetUsers retrieves users from database.

func (*Authenticator) IdentifyUser

func (sa *Authenticator) IdentifyUser(r *requests.Request) error

IdentifyUser returns user challenges.

func (*Authenticator) LookupAPIKey

func (sa *Authenticator) LookupAPIKey(r *requests.Request) error

LookupAPIKey performs user lookup based on an API key.

type Backend

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

Backend represents authentication provider with local backend.

func NewDatabaseBackend

func NewDatabaseBackend(cfg *Config, logger *zap.Logger) *Backend

NewDatabaseBackend return an instance of authentication provider with local backend.

func (*Backend) Authenticate

func (b *Backend) Authenticate(r *requests.Request) error

Authenticate performs authentication.

func (*Backend) Configure

func (b *Backend) Configure() error

Configure configures Backend.

func (*Backend) GetConfig

func (b *Backend) GetConfig() string

GetConfig returns Backend configuration.

func (*Backend) GetMethod

func (b *Backend) GetMethod() string

GetMethod returns the authentication method associated with this backend.

func (*Backend) GetName

func (b *Backend) GetName() string

GetName return the name associated with this backend.

func (*Backend) GetRealm

func (b *Backend) GetRealm() string

GetRealm return authentication realm.

func (*Backend) Request

func (b *Backend) Request(op operator.Type, r *requests.Request) error

Request performs the requested backend operation.

func (*Backend) Validate

func (b *Backend) Validate() error

Validate checks whether Backend is functional.

type Config

type Config struct {
	Name   string `json:"name,omitempty"`
	Method string `json:"method,omitempty"`
	Realm  string `json:"realm,omitempty"`
	Path   string `json:"path,omitempty"`
}

Config holds the configuration for the backend.

Jump to

Keyboard shortcuts

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