local

package
v1.0.47 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 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) 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, users []*User) 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 Config

type Config struct {
	Name  string  `json:"name,omitempty" xml:"name,omitempty" yaml:"name,omitempty"`
	Realm string  `json:"realm,omitempty" xml:"realm,omitempty" yaml:"realm,omitempty"`
	Path  string  `json:"path,omitempty" xml:"path,omitempty" yaml:"path,omitempty"`
	Users []*User `json:"users,omitempty" xml:"users,omitempty" yaml:"users,omitempty"`

	// LoginIcon is the UI login icon attributes.
	LoginIcon *icons.LoginIcon `json:"login_icon,omitempty" xml:"login_icon,omitempty" yaml:"login_icon,omitempty"`

	// RegistrationEnabled controls whether visitors can registers.
	RegistrationEnabled bool `json:"registration_enabled,omitempty" xml:"registration_enabled,omitempty" yaml:"registration_enabled,omitempty"`
	// UsernameRecoveryEnabled controls whether a user could recover username by providing an email address.
	UsernameRecoveryEnabled bool `` /* 127-byte string literal not displayed */
	// PasswordRecoveryEnabled controls whether a user could recover password by providing an email address.
	PasswordRecoveryEnabled bool `` /* 127-byte string literal not displayed */
	// ContactSupportEnabled controls whether contact support link is available.
	ContactSupportEnabled bool `json:"contact_support_enabled,omitempty" xml:"contact_support_enabled,omitempty" yaml:"contact_support_enabled,omitempty"`

	// SupportLink is the link to the support portal.
	SupportLink string `json:"support_link,omitempty" xml:"support_link,omitempty" yaml:"support_link,omitempty"`
	// SupportEmail is the email address to reach support.
	SupportEmail string `json:"support_email,omitempty" xml:"support_email,omitempty" yaml:"support_email,omitempty"`
}

Config holds the configuration for the identity store.

func (*Config) Validate

func (cfg *Config) Validate() error

Validate validates identity store configuration.

type IdentityStore

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

IdentityStore represents authentication provider with local identity store.

func NewIdentityStore

func NewIdentityStore(cfg *Config, logger *zap.Logger) (*IdentityStore, error)

NewIdentityStore return an instance of AuthDB-based identity store.

func (*IdentityStore) Authenticate

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

Authenticate performs authentication.

func (*IdentityStore) Configure

func (b *IdentityStore) Configure() error

Configure configures IdentityStore.

func (*IdentityStore) Configured

func (b *IdentityStore) Configured() bool

Configured returns true if the identity store was configured.

func (*IdentityStore) GetConfig

func (b *IdentityStore) GetConfig() map[string]interface{}

GetConfig returns IdentityStore configuration.

func (*IdentityStore) GetKind

func (b *IdentityStore) GetKind() string

GetKind returns the authentication method associated with this identity store.

func (*IdentityStore) GetLoginIcon

func (b *IdentityStore) GetLoginIcon() *icons.LoginIcon

GetLoginIcon returns the instance of the icon associated with the provider.

func (*IdentityStore) GetName

func (b *IdentityStore) GetName() string

GetName return the name associated with this identity store.

func (*IdentityStore) GetRealm

func (b *IdentityStore) GetRealm() string

GetRealm return authentication realm.

func (*IdentityStore) Request

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

Request performs the requested identity store operation.

type User

type User struct {
	Username                 string   `json:"username,omitempty" xml:"username,omitempty" yaml:"username,omitempty"`
	EmailAddress             string   `json:"email_address,omitempty" xml:"email_address,omitempty" yaml:"email_address,omitempty"`
	Name                     string   `json:"name,omitempty" xml:"name,omitempty" yaml:"name,omitempty"`
	Roles                    []string `json:"roles,omitempty" xml:"roles,omitempty" yaml:"roles,omitempty"`
	Password                 string   `json:"password,omitempty" xml:"password,omitempty" yaml:"password,omitempty"`
	PasswordOverwriteEnabled bool     `` /* 130-byte string literal not displayed */
}

User holds the configuration for the identity store user.

Jump to

Keyboard shortcuts

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