authentication

package
v4.39.1 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2025 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ValueTypeString  = "string"
	ValueTypeInteger = "integer"
	ValueTypeBoolean = "boolean"
)

Variables

View Source
var (
	// ErrUserNotFound indicates the user wasn't found in the authentication backend.
	ErrUserNotFound = errors.New("user not found")

	// ErrNoContent is returned when the file is empty.
	ErrNoContent = errors.New("no file content")

	ErrOperationFailed = errors.New("operation failed")

	// ErrIncorrectPassword is returned when the password provided is incorrect.
	ErrIncorrectPassword = errors.New("incorrect password")

	ErrPasswordWeak = errors.New("your supplied password does not meet the password policy requirements")

	ErrAuthenticationFailed = errors.New("authentication failed")
)

Functions

func NewFileCryptoHashFromConfig added in v4.37.0

func NewFileCryptoHashFromConfig(config schema.AuthenticationBackendFilePassword) (hash algorithm.Hash, err error)

NewFileCryptoHashFromConfig returns a crypt.Hash given a valid configuration.

func WithAddress added in v4.39.0

func WithAddress(address string) func(*LDAPClientFactoryOptions)

func WithPassword added in v4.39.0

func WithPassword(password string) func(*LDAPClientFactoryOptions)

func WithUsername added in v4.39.0

func WithUsername(username string) func(*LDAPClientFactoryOptions)

Types

type CachedCredential added in v4.39.0

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

CachedCredential is a cached credential which has an expiration and checksum value.

type CredentialCacheHMAC added in v4.39.0

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

CredentialCacheHMAC implements in-memory credential caching using a HMAC function and effective lifespan.

func NewCredentialCacheHMAC added in v4.39.0

func NewCredentialCacheHMAC(h func() hash.Hash, lifespan time.Duration) *CredentialCacheHMAC

NewCredentialCacheHMAC creates a new CredentialCacheHMAC with a given hash.Hash func and lifespan.

func (*CredentialCacheHMAC) Put added in v4.39.0

func (c *CredentialCacheHMAC) Put(username, password string) (err error)

Put a new credential combination into the cache.

func (*CredentialCacheHMAC) Valid added in v4.39.0

func (c *CredentialCacheHMAC) Valid(username, password string) (valid, ok bool)

Valid checks the cache for results for a given username and password in the cache and returns two booleans. The valid return value is indicative if the credential cache had an exact match, and the ok return value returns true if a current cached value exists within the cache.

type FileDatabaseModel added in v4.38.0

type FileDatabaseModel struct {
	Users map[string]FileDatabaseUserDetailsModel `` /* 126-byte string literal not displayed */
}

FileDatabaseModel is the model of users file database.

func (*FileDatabaseModel) Read added in v4.38.0

func (m *FileDatabaseModel) Read(filePath string) (err error)

Read a FileDatabaseModel from disk.

func (*FileDatabaseModel) ReadToFileUserDatabase added in v4.38.0

func (m *FileDatabaseModel) ReadToFileUserDatabase(db *FileUserDatabase, extra map[string]expression.ExtraAttribute) (err error)

ReadToFileUserDatabase reads the FileDatabaseModel into a FileUserDatabase.

func (*FileDatabaseModel) Write added in v4.38.0

func (m *FileDatabaseModel) Write(fileName string) (err error)

Write a FileDatabaseModel to disk.

type FileDatabaseUserDetailsModel added in v4.38.0

type FileDatabaseUserDetailsModel struct {
	Password       string   `yaml:"password" valid:"required"`
	DisplayName    string   `yaml:"displayname" valid:"required"`
	Email          string   `yaml:"email"`
	Groups         []string `yaml:"groups"`
	GivenName      string   `yaml:"given_name"`
	MiddleName     string   `yaml:"middle_name"`
	FamilyName     string   `yaml:"family_name"`
	Nickname       string   `yaml:"nickname"`
	Gender         string   `yaml:"gender"`
	Birthdate      string   `yaml:"birthdate"`
	Website        string   `yaml:"website"`
	Profile        string   `yaml:"profile"`
	Picture        string   `yaml:"picture"`
	ZoneInfo       string   `yaml:"zoneinfo"`
	Locale         string   `yaml:"locale"`
	PhoneNumber    string   `yaml:"phone_number"`
	PhoneExtension string   `yaml:"phone_extension"`
	Disabled       bool     `yaml:"disabled"`

	Address *FileUserDatabaseUserDetailsAddressModel `yaml:"address"`

	Extra map[string]any `yaml:"extra"`
}

FileDatabaseUserDetailsModel is the model of user details in the file database.

func (FileDatabaseUserDetailsModel) ToDatabaseUserDetailsModel added in v4.38.0

func (m FileDatabaseUserDetailsModel) ToDatabaseUserDetailsModel(username string) (model *FileUserDatabaseUserDetails, err error)

ToDatabaseUserDetailsModel converts a FileDatabaseUserDetailsModel into a *FileUserDatabaseUserDetails.

func (FileDatabaseUserDetailsModel) ValidateExtra added in v4.39.0

func (m FileDatabaseUserDetailsModel) ValidateExtra(username string, extra map[string]expression.ExtraAttribute) (err error)

type FileUserDatabase added in v4.37.0

type FileUserDatabase struct {
	*sync.RWMutex `json:"-"`

	Users map[string]FileUserDatabaseUserDetails `json:"users" jsonschema:"required,title=Users" jsonschema_description:"The dictionary of users."`

	Path    string            `json:"-"`
	Emails  map[string]string `json:"-"`
	Aliases map[string]string `json:"-"`

	SearchEmail bool `json:"-"`
	SearchCI    bool `json:"-"`

	Extra map[string]expression.ExtraAttribute
}

FileUserDatabase is a user details database that is concurrency safe database and can be reloaded.

func NewFileUserDatabase added in v4.37.0

func NewFileUserDatabase(filePath string, searchEmail, searchCI bool, extra map[string]expression.ExtraAttribute) (database *FileUserDatabase)

NewFileUserDatabase creates a new FileUserDatabase.

func (*FileUserDatabase) GetUserDetails added in v4.37.0

func (m *FileUserDatabase) GetUserDetails(username string) (user FileUserDatabaseUserDetails, err error)

GetUserDetails get a FileUserDatabaseUserDetails given a username as a value type where the username must be the users actual username.

func (*FileUserDatabase) Load added in v4.37.0

func (m *FileUserDatabase) Load() (err error)

Load the database from disk.

func (*FileUserDatabase) LoadAliases added in v4.37.0

func (m *FileUserDatabase) LoadAliases() (err error)

LoadAliases performs the loading of alias information from the database.

func (*FileUserDatabase) Save added in v4.37.0

func (m *FileUserDatabase) Save() (err error)

Save the database to disk.

func (*FileUserDatabase) SetUserDetails added in v4.37.0

func (m *FileUserDatabase) SetUserDetails(username string, details *FileUserDatabaseUserDetails)

SetUserDetails sets the FileUserDatabaseUserDetails for a given user.

func (*FileUserDatabase) ToDatabaseModel added in v4.37.0

func (m *FileUserDatabase) ToDatabaseModel() (model *FileDatabaseModel)

ToDatabaseModel converts the FileUserDatabase into the FileDatabaseModel for saving.

type FileUserDatabaseUserDetails added in v4.38.0

type FileUserDatabaseUserDetails struct {
	Username       string                 `json:"-"`
	Password       *schema.PasswordDigest `json:"password" jsonschema:"required,title=Password" jsonschema_description:"The hashed password for the user."`
	DisplayName    string                 `json:"displayname" jsonschema:"required,title=Display Name" jsonschema_description:"The display name for the user."`
	GivenName      string                 `json:"given_name,omitempty" jsonschema:"title=Given Name" jsonschema_description:"The given name for the user."`
	MiddleName     string                 `json:"middle_name,omitempty" jsonschema:"title=Middle Name" jsonschema_description:"The middle name for the user."`
	FamilyName     string                 `json:"family_name,omitempty" jsonschema:"title=Family Name" jsonschema_description:"The family name for the user."`
	Nickname       string                 `json:"nickname,omitempty" jsonschema:"title=Nickname" jsonschema_description:"The nickname for the user."`
	Gender         string                 `json:"gender,omitempty" jsonschema:"title=Gender" jsonschema_description:"The gender for the user."`
	Birthdate      string                 `json:"birthdate,omitempty" jsonschema:"title=Birthdate" jsonschema_description:"The birthdate for the user."`
	Website        *url.URL               `json:"website,omitempty" jsonschema:"title=Website" jsonschema_description:"The website URL for the user."`
	Profile        *url.URL               `json:"profile,omitempty" jsonschema:"title=Profile" jsonschema_description:"The profile URL for the user."`
	Picture        *url.URL               `json:"picture,omitempty" jsonschema:"title=Picture" jsonschema_description:"The picture URL for the user."`
	ZoneInfo       string                 `json:"zoneinfo,omitempty" jsonschema:"title=Zone Information" jsonschema_description:"The time zone for the user."`
	Locale         *language.Tag          `json:"locale,omitempty" jsonschema:"title=Locale" jsonschema_description:"The BCP47 locale for the user."`
	PhoneNumber    string                 `json:"phone_number,omitempty" jsonschema:"title=Phone Number" jsonschema_description:"The phone number for the user."`
	PhoneExtension string                 `` /* 126-byte string literal not displayed */
	Email          string                 `json:"email" jsonschema:"title=Email" jsonschema_description:"The email for the user."`
	Groups         []string               `json:"groups" jsonschema:"title=Groups" jsonschema_description:"The groups list for the user."`
	Disabled       bool                   `json:"disabled" jsonschema:"default=false,title=Disabled" jsonschema_description:"The disabled status for the user."`

	Address *FileUserDatabaseUserDetailsAddressModel `json:"address,omitempty" jsonschema:"title=Address" jsonschema_description:"The address for the user."`

	Extra map[string]any `json:"extra" jsonschema:"title=Extra" jsonschema_description:"The extra attributes for the user."`
}

FileUserDatabaseUserDetails is the model of user details in the file database.

func (FileUserDatabaseUserDetails) ToExtendedUserDetails added in v4.39.0

func (m FileUserDatabaseUserDetails) ToExtendedUserDetails() (details *UserDetailsExtended)

ToExtendedUserDetails converts FileUserDatabaseUserDetails into a *UserDetailsExtended.

func (FileUserDatabaseUserDetails) ToUserDetails added in v4.38.0

func (m FileUserDatabaseUserDetails) ToUserDetails() (details *UserDetails)

ToUserDetails converts FileUserDatabaseUserDetails into a *UserDetails.

func (FileUserDatabaseUserDetails) ToUserDetailsModel added in v4.38.0

func (m FileUserDatabaseUserDetails) ToUserDetailsModel() (model FileDatabaseUserDetailsModel)

ToUserDetailsModel converts FileUserDatabaseUserDetails into a FileDatabaseUserDetailsModel.

type FileUserDatabaseUserDetailsAddressModel added in v4.39.0

type FileUserDatabaseUserDetailsAddressModel struct {
	StreetAddress string `` /* 145-byte string literal not displayed */
	Locality      string `yaml:"locality" json:"locality,omitempty" jsonschema:"title=Locality" jsonschema_description:"The locality for the user."`
	Region        string `yaml:"region" json:"region,omitempty" jsonschema:"title=Region" jsonschema_description:"The region for the user."`
	PostalCode    string `` /* 145-byte string literal not displayed */
	Country       string `yaml:"country" json:"country,omitempty" jsonschema:"title=Country" jsonschema_description:"The country for the user."`
}

type FileUserProvider

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

FileUserProvider is a provider reading details from a file.

func NewFileUserProvider

func NewFileUserProvider(config *schema.AuthenticationBackendFile) (provider *FileUserProvider)

NewFileUserProvider creates a new instance of FileUserProvider.

func (*FileUserProvider) ChangePassword added in v4.39.0

func (p *FileUserProvider) ChangePassword(username string, oldPassword string, newPassword string) (err error)

func (*FileUserProvider) CheckUserPassword

func (p *FileUserProvider) CheckUserPassword(username string, password string) (match bool, err error)

CheckUserPassword checks if provided password matches for the given user.

func (*FileUserProvider) Close added in v4.39.0

func (p *FileUserProvider) Close() (err error)

func (*FileUserProvider) GetDetails

func (p *FileUserProvider) GetDetails(username string) (details *UserDetails, err error)

GetDetails retrieve the groups a user belongs to.

func (*FileUserProvider) GetDetailsExtended added in v4.39.0

func (p *FileUserProvider) GetDetailsExtended(username string) (details *UserDetailsExtended, err error)

func (*FileUserProvider) Reload added in v4.37.0

func (p *FileUserProvider) Reload() (reloaded bool, err error)

Reload the database.

func (*FileUserProvider) StartupCheck added in v4.31.0

func (p *FileUserProvider) StartupCheck() (err error)

StartupCheck implements the startup check provider interface.

func (*FileUserProvider) UpdatePassword

func (p *FileUserProvider) UpdatePassword(username string, newPassword string) (err error)

UpdatePassword update the password of the given user.

type FileUserProviderDatabase added in v4.38.0

type FileUserProviderDatabase interface {
	Save() (err error)
	Load() (err error)
	GetUserDetails(username string) (user FileUserDatabaseUserDetails, err error)
	SetUserDetails(username string, details *FileUserDatabaseUserDetails)
}

type LDAPClientDialer added in v4.39.0

type LDAPClientDialer interface {
	// DialURL takes a single address and dials it returning the ldap.Client.
	DialURL(addr string, opts ...ldap.DialOpt) (client ldap.Client, err error)
}

LDAPClientDialer is an abstract type that dials a ldap.Client.

type LDAPClientDialerStandard added in v4.39.0

type LDAPClientDialerStandard struct{}

LDAPClientDialerStandard is a concrete type that dials a ldap.Client and returns it, implementing the LDAPClientDialer.

func NewLDAPClientDialerStandard added in v4.39.0

func NewLDAPClientDialerStandard() *LDAPClientDialerStandard

NewLDAPClientDialerStandard returns a new *LDAPClientDialerStandard.

func (*LDAPClientDialerStandard) DialURL added in v4.39.0

func (d *LDAPClientDialerStandard) DialURL(addr string, opts ...ldap.DialOpt) (client ldap.Client, err error)

DialURL takes a single address and dials it returning the ldap.Client.

type LDAPClientFactory added in v4.35.3

type LDAPClientFactory interface {
	Initialize() (err error)
	GetClient(opts ...LDAPClientFactoryOption) (client ldap.Client, err error)
	ReleaseClient(client ldap.Client) (err error)
	Close() (err error)
}

LDAPClientFactory an interface describing factories that produce LDAPConnection implementations.

func NewPooledLDAPClientFactory added in v4.39.0

func NewPooledLDAPClientFactory(config *schema.AuthenticationBackendLDAP, certs *x509.CertPool, dialer LDAPClientDialer) (factory LDAPClientFactory)

NewPooledLDAPClientFactory is a decorator for a LDAPClientFactory that performs pooling.

func NewStandardLDAPClientFactory added in v4.39.0

func NewStandardLDAPClientFactory(config *schema.AuthenticationBackendLDAP, certs *x509.CertPool, dialer LDAPClientDialer) LDAPClientFactory

NewStandardLDAPClientFactory create a concrete ldap connection factory.

type LDAPClientFactoryOption added in v4.39.0

type LDAPClientFactoryOption func(*LDAPClientFactoryOptions)

type LDAPClientFactoryOptions added in v4.39.0

type LDAPClientFactoryOptions struct {
	Address  string
	Username string
	Password string
}

type LDAPClientPooled added in v4.39.0

type LDAPClientPooled struct {
	ldap.Client
}

LDAPClientPooled is a decorator for the ldap.Client which handles the pooling functionality. i.e. prevents the client from being closed and instead relinquishes the connection back to the pool.

type LDAPSupportedControlTypes added in v4.35.3

type LDAPSupportedControlTypes struct {
	MsftPwdPolHints           bool
	MsftPwdPolHintsDeprecated bool
}

LDAPSupportedControlTypes represents control types which a server may support which are implemented in code.

type LDAPSupportedExtensions added in v4.35.3

type LDAPSupportedExtensions struct {
	TLS           bool
	PwdModifyExOp bool
}

LDAPSupportedExtensions represents extensions which a server may support which are implemented in code.

type LDAPSupportedFeatures added in v4.35.3

type LDAPSupportedFeatures struct {
	Extensions   LDAPSupportedExtensions
	ControlTypes LDAPSupportedControlTypes
}

LDAPSupportedFeatures represents features which a server may support which are implemented in code.

type LDAPUserProvider

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

LDAPUserProvider is a UserProvider that connects to LDAP servers like ActiveDirectory, OpenLDAP, OpenDJ, FreeIPA, etc.

func NewLDAPUserProvider

func NewLDAPUserProvider(config schema.AuthenticationBackend, certs *x509.CertPool) (provider *LDAPUserProvider)

NewLDAPUserProvider creates a new instance of LDAPUserProvider with the StandardLDAPClientFactory.

func NewLDAPUserProviderWithFactory added in v4.38.0

func NewLDAPUserProviderWithFactory(config *schema.AuthenticationBackendLDAP, disableResetPassword bool, factory LDAPClientFactory) (provider *LDAPUserProvider)

NewLDAPUserProviderWithFactory creates a new instance of LDAPUserProvider with the specified LDAPClientFactory.

func (*LDAPUserProvider) ChangePassword added in v4.39.0

func (p *LDAPUserProvider) ChangePassword(username, oldPassword string, newPassword string) (err error)

ChangePassword is used to change a user's password but requires their old password to be successfully verified.

func (*LDAPUserProvider) CheckUserPassword

func (p *LDAPUserProvider) CheckUserPassword(username string, password string) (valid bool, err error)

CheckUserPassword checks if provided password matches for the given user.

func (*LDAPUserProvider) Close added in v4.39.0

func (p *LDAPUserProvider) Close() (err error)

func (*LDAPUserProvider) GetDetails

func (p *LDAPUserProvider) GetDetails(username string) (details *UserDetails, err error)

GetDetails retrieve the groups a user belongs to.

func (*LDAPUserProvider) GetDetailsExtended added in v4.39.0

func (p *LDAPUserProvider) GetDetailsExtended(username string) (details *UserDetailsExtended, err error)

GetDetailsExtended retrieves the UserDetailsExtended values.

func (*LDAPUserProvider) StartupCheck added in v4.31.0

func (p *LDAPUserProvider) StartupCheck() (err error)

StartupCheck implements the startup check provider interface.

func (*LDAPUserProvider) UpdatePassword

func (p *LDAPUserProvider) UpdatePassword(username, password string) (err error)

UpdatePassword update the password of the given user.

type Level

type Level int

Level is the type representing a level of authentication.

const (
	// NotAuthenticated if the user is not authenticated yet.
	NotAuthenticated Level = iota

	// OneFactor if the user has passed first factor only.
	OneFactor

	// TwoFactor if the user has passed two factors.
	TwoFactor
)

func (Level) String added in v4.37.5

func (l Level) String() string

String returns a string representation of an authentication.Level.

type PooledLDAPClientFactory added in v4.39.0

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

PooledLDAPClientFactory is a LDAPClientFactory that takes another LDAPClientFactory and pools the factory generated connections using a channel for thread safety.

func (*PooledLDAPClientFactory) Close added in v4.39.0

func (f *PooledLDAPClientFactory) Close() (err error)

func (*PooledLDAPClientFactory) GetClient added in v4.39.0

func (f *PooledLDAPClientFactory) GetClient(opts ...LDAPClientFactoryOption) (conn ldap.Client, err error)

GetClient opens new client using the pool.

func (*PooledLDAPClientFactory) Initialize added in v4.39.0

func (f *PooledLDAPClientFactory) Initialize() (err error)

func (*PooledLDAPClientFactory) ReleaseClient added in v4.39.0

func (f *PooledLDAPClientFactory) ReleaseClient(client ldap.Client) (err error)

ReleaseClient returns a client using the pool or closes it.

type StandardLDAPClientFactory added in v4.39.0

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

StandardLDAPClientFactory the production implementation of an ldap connection factory.

func (*StandardLDAPClientFactory) Close added in v4.39.0

func (f *StandardLDAPClientFactory) Close() (err error)

func (*StandardLDAPClientFactory) GetClient added in v4.39.0

func (f *StandardLDAPClientFactory) GetClient(opts ...LDAPClientFactoryOption) (client ldap.Client, err error)

func (*StandardLDAPClientFactory) Initialize added in v4.39.0

func (f *StandardLDAPClientFactory) Initialize() (err error)

func (*StandardLDAPClientFactory) ReleaseClient added in v4.39.0

func (f *StandardLDAPClientFactory) ReleaseClient(client ldap.Client) (err error)

type UserDetails

type UserDetails struct {
	Username    string
	DisplayName string
	Emails      []string
	Groups      []string
}

UserDetails represent the details retrieved for a given user.

func (*UserDetails) Addresses added in v4.36.3

func (d *UserDetails) Addresses() (addresses []mail.Address)

Addresses returns the Emails []string as []mail.Address formatted with DisplayName as the Name attribute.

func (*UserDetails) GetDisplayName added in v4.38.7

func (d *UserDetails) GetDisplayName() (name string)

func (*UserDetails) GetEmails added in v4.38.7

func (d *UserDetails) GetEmails() (emails []string)

func (*UserDetails) GetGroups added in v4.38.7

func (d *UserDetails) GetGroups() (groups []string)

func (*UserDetails) GetUsername added in v4.38.7

func (d *UserDetails) GetUsername() (username string)

type UserDetailsAddress added in v4.39.0

type UserDetailsAddress struct {
	StreetAddress string
	Locality      string
	Region        string
	PostalCode    string
	Country       string
}

type UserDetailsExtended added in v4.39.0

type UserDetailsExtended struct {
	GivenName      string
	FamilyName     string
	MiddleName     string
	Nickname       string
	Profile        *url.URL
	Picture        *url.URL
	Website        *url.URL
	Gender         string
	Birthdate      string
	ZoneInfo       string
	Locale         *language.Tag
	PhoneNumber    string
	PhoneExtension string
	Address        *UserDetailsAddress

	Extra map[string]any

	*UserDetails
}

UserDetailsExtended represents the extended details retrieved for a given user.

func (*UserDetailsExtended) GetBirthdate added in v4.39.0

func (d *UserDetailsExtended) GetBirthdate() (birthdate string)

func (*UserDetailsExtended) GetCountry added in v4.39.0

func (d *UserDetailsExtended) GetCountry() (country string)

func (*UserDetailsExtended) GetExtra added in v4.39.0

func (d *UserDetailsExtended) GetExtra() (extra map[string]any)

func (*UserDetailsExtended) GetFamilyName added in v4.39.0

func (d *UserDetailsExtended) GetFamilyName() (family string)

func (*UserDetailsExtended) GetGender added in v4.39.0

func (d *UserDetailsExtended) GetGender() (gender string)

func (*UserDetailsExtended) GetGivenName added in v4.39.0

func (d *UserDetailsExtended) GetGivenName() (given string)

func (*UserDetailsExtended) GetLocale added in v4.39.0

func (d *UserDetailsExtended) GetLocale() (locale string)

func (*UserDetailsExtended) GetLocality added in v4.39.0

func (d *UserDetailsExtended) GetLocality() (locality string)

func (*UserDetailsExtended) GetMiddleName added in v4.39.0

func (d *UserDetailsExtended) GetMiddleName() (middle string)

func (*UserDetailsExtended) GetNickname added in v4.39.0

func (d *UserDetailsExtended) GetNickname() (nickname string)

func (*UserDetailsExtended) GetPhoneExtension added in v4.39.0

func (d *UserDetailsExtended) GetPhoneExtension() (extension string)

func (*UserDetailsExtended) GetPhoneNumber added in v4.39.0

func (d *UserDetailsExtended) GetPhoneNumber() (number string)

func (*UserDetailsExtended) GetPhoneNumberRFC3966 added in v4.39.0

func (d *UserDetailsExtended) GetPhoneNumberRFC3966() (number string)

func (*UserDetailsExtended) GetPicture added in v4.39.0

func (d *UserDetailsExtended) GetPicture() (picture string)

func (*UserDetailsExtended) GetPostalCode added in v4.39.0

func (d *UserDetailsExtended) GetPostalCode() (postcode string)

func (*UserDetailsExtended) GetProfile added in v4.39.0

func (d *UserDetailsExtended) GetProfile() (profile string)

func (*UserDetailsExtended) GetRegion added in v4.39.0

func (d *UserDetailsExtended) GetRegion() (region string)

func (*UserDetailsExtended) GetStreetAddress added in v4.39.0

func (d *UserDetailsExtended) GetStreetAddress() (address string)

func (*UserDetailsExtended) GetWebsite added in v4.39.0

func (d *UserDetailsExtended) GetWebsite() (website string)

func (*UserDetailsExtended) GetZoneInfo added in v4.39.0

func (d *UserDetailsExtended) GetZoneInfo() (info string)

type UserProvider

type UserProvider interface {
	model.StartupCheck

	// CheckUserPassword is used to check if a password matches for a specific user.
	CheckUserPassword(username string, password string) (valid bool, err error)

	// GetDetails is used to get a user's information.
	GetDetails(username string) (details *UserDetails, err error)

	GetDetailsExtended(username string) (details *UserDetailsExtended, err error)

	// UpdatePassword is used to change a user's password without verifying their old password.
	UpdatePassword(username string, newPassword string) (err error)

	// ChangePassword is used to change a user's password but requires their old password to be successfully verified.
	ChangePassword(username string, oldPassword string, newPassword string) (err error)

	Close() (err error)
}

UserProvider is the interface for interacting with the authentication backends.

Jump to

Keyboard shortcuts

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