Documentation ¶
Index ¶
- func WritePasswordsToTempFile(folder string, entries map[string]authapi.AuthnEntry) (tempFileName string, err error)
- type AuthnFileStore
- func (authnStore *AuthnFileStore) Add(clientID string, profile authapi.ClientProfile) error
- func (authnStore *AuthnFileStore) Close()
- func (authnStore *AuthnFileStore) Count() int
- func (authnStore *AuthnFileStore) GetAuthClientList() []msgserver.ClientAuthInfo
- func (authnStore *AuthnFileStore) GetEntries() (entries []authapi.AuthnEntry)
- func (authnStore *AuthnFileStore) GetProfile(clientID string) (profile authapi.ClientProfile, err error)
- func (authnStore *AuthnFileStore) GetProfiles() (profiles []authapi.ClientProfile, err error)
- func (authnStore *AuthnFileStore) Open() (err error)
- func (authnStore *AuthnFileStore) Reload() error
- func (authnStore *AuthnFileStore) Remove(clientID string) (err error)
- func (authnStore *AuthnFileStore) SetPassword(loginID string, password string) (err error)
- func (authnStore *AuthnFileStore) SetPasswordHash(loginID string, hash string) (err error)
- func (authnStore *AuthnFileStore) Update(clientID string, profile authapi.ClientProfile) error
- func (authnStore *AuthnFileStore) VerifyPassword(loginID, password string) (profile authapi.ClientProfile, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WritePasswordsToTempFile ¶
func WritePasswordsToTempFile( folder string, entries map[string]authapi.AuthnEntry) (tempFileName string, err error)
WritePasswordsToTempFile write the given entries to temp file in the given folder This returns the name of the new temp file.
Types ¶
type AuthnFileStore ¶
type AuthnFileStore struct {
// contains filtered or unexported fields
}
AuthnFileStore stores client data, including users, devices and services. User passwords are stored using ARGON2id hash It includes a file watcher to automatically reload on update.
func NewAuthnFileStore ¶
func NewAuthnFileStore(filepath string, hashAlgo string) *AuthnFileStore
NewAuthnFileStore creates a new instance of a file based identity store. Call Open/Release to start/stop using this store. Note: this store is intended for one writer and many readers. Multiple concurrent writes are not supported and might lead to one write being ignored.
filepath location of the file store. See also DefaultPasswordFile for the recommended name hashAlgo PWHASH_ARGON2id (default) or PWHASH_BCRYPT
func (*AuthnFileStore) Add ¶
func (authnStore *AuthnFileStore) Add(clientID string, profile authapi.ClientProfile) error
Add a new client. clientID, clientType are required, the rest is optional
func (*AuthnFileStore) Count ¶
func (authnStore *AuthnFileStore) Count() int
Count nr of entries in the store
func (*AuthnFileStore) GetAuthClientList ¶
func (authnStore *AuthnFileStore) GetAuthClientList() []msgserver.ClientAuthInfo
GetAuthClientList provides a list of clients to apply to the message server
func (*AuthnFileStore) GetEntries ¶
func (authnStore *AuthnFileStore) GetEntries() (entries []authapi.AuthnEntry)
GetEntries returns a list of all profiles with their hashed passwords
func (*AuthnFileStore) GetProfile ¶
func (authnStore *AuthnFileStore) GetProfile(clientID string) (profile authapi.ClientProfile, err error)
GetProfile returns the client's profile
func (*AuthnFileStore) GetProfiles ¶
func (authnStore *AuthnFileStore) GetProfiles() (profiles []authapi.ClientProfile, err error)
GetProfiles returns a list of all client profiles in the store
func (*AuthnFileStore) Open ¶
func (authnStore *AuthnFileStore) Open() (err error)
Open the store This reads the password file and subscribes to file changes
func (*AuthnFileStore) Reload ¶
func (authnStore *AuthnFileStore) Reload() error
Reload the password store from file and subscribe to file changes
If the file does not exist, it will be created. Returns an error if the file could not be opened/created.
func (*AuthnFileStore) Remove ¶
func (authnStore *AuthnFileStore) Remove(clientID string) (err error)
Remove a client from the store
func (*AuthnFileStore) SetPassword ¶
func (authnStore *AuthnFileStore) SetPassword(loginID string, password string) (err error)
SetPassword generates and stores the user's password hash bcrypt limits max password length to 72 bytes
func (*AuthnFileStore) SetPasswordHash ¶
func (authnStore *AuthnFileStore) SetPasswordHash(loginID string, hash string) (err error)
SetPasswordHash adds/updates the password hash for the given login ID Intended for use by administrators to add a new user or clients to update their password
func (*AuthnFileStore) Update ¶
func (authnStore *AuthnFileStore) Update(clientID string, profile authapi.ClientProfile) error
Update updates the client profile, except
func (*AuthnFileStore) VerifyPassword ¶
func (authnStore *AuthnFileStore) VerifyPassword(loginID, password string) (profile authapi.ClientProfile, err error)
VerifyPassword verifies the given password with the stored hash This returns the matching user's entry or an error if the password doesn't match