Documentation ¶
Index ¶
- Constants
- func WritePasswordsToTempFile(folder string, passwords map[string]string) (tempFileName string, err error)
- type PasswordFileStore
- func (pwStore *PasswordFileStore) Close()
- func (pwStore *PasswordFileStore) Count() int
- func (pwStore *PasswordFileStore) GetPasswordHash(username string) string
- func (pwStore *PasswordFileStore) Open() error
- func (pwStore *PasswordFileStore) Reload() error
- func (pwStore *PasswordFileStore) SetPasswordHash(loginID string, hash string) error
Constants ¶
const DefaultPasswordFile = "hub.passwd"
DefaultPasswordFile is the recommended password filename for Hub authentication
Variables ¶
This section is empty.
Functions ¶
Types ¶
type PasswordFileStore ¶
type PasswordFileStore struct {
// contains filtered or unexported fields
}
PasswordFileStore stores a list of user login names and their password info It includes a file watcher to automatically reload on update.
func NewPasswordFileStore ¶
func NewPasswordFileStore(filepath string, clientID string) *PasswordFileStore
NewPasswordFileStore creates a new instance of a file based username/password 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 clientID is authservice ID to include in logging
func (*PasswordFileStore) Count ¶
func (pwStore *PasswordFileStore) Count() int
Count nr of entries in the store
func (*PasswordFileStore) GetPasswordHash ¶
func (pwStore *PasswordFileStore) GetPasswordHash(username string) string
GetPasswordHash returns the stored encoded password hash for the given user returns hash or "" if user not found
func (*PasswordFileStore) Open ¶
func (pwStore *PasswordFileStore) Open() error
Open the store This reads the password file and subscribes to file changes
func (*PasswordFileStore) Reload ¶
func (pwStore *PasswordFileStore) Reload() error
Reload the password store from file and subscribe to file changes If subscription already exists it is removed and renewed.
File format: <loginname>:bcrypt(passwd)
Returns error if the file could not be opened
func (*PasswordFileStore) SetPasswordHash ¶
func (pwStore *PasswordFileStore) SetPasswordHash(loginID string, hash string) 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