users

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const USERSTORE_FILENAME = "users.json"

Variables

View Source
var UserStoreMu sync.Mutex

Functions

func HashPassword

func HashPassword(password string) (string, error)

Types

type DeleteFunc

type DeleteFunc func(storage.Iface, User) error

type DisableFunc

type DisableFunc func(storage.Iface, User) error

type Factor

type Factor struct {
	Name   string `json:"name"`
	Type   string `json:"type"`
	Secret string `json:"secret"`
}

type ReactivateFunc

type ReactivateFunc func(storage.Iface, User) error

type User

type User struct {
	ID                               string    `json:"id"`
	Login                            string    `json:"login"`
	Role                             string    `json:"role"`
	OIDCID                           string    `json:"oidcID,omitempty"`
	SAMLID                           string    `json:"samlID,omitempty"`
	Provisioned                      bool      `json:"provisioned,omitempty"`
	Password                         string    `json:"password,omitempty"`
	Suspended                        bool      `json:"suspended"`
	ConnectionsDisabledOnAuthFailure bool      `json:"connectionsDisabledOnAuthFailure"`
	Factors                          []Factor  `json:"factors"`
	ExternalID                       string    `json:"externalID,omitempty"`
	LastLogin                        time.Time `json:"lastLogin"`
}

type UserHooks

type UserHooks struct {
	DisableFunc    DisableFunc
	ReactivateFunc ReactivateFunc
	DeleteFunc     DeleteFunc
}

type UserStore

type UserStore struct {
	Users []User `json:"users"`

	UserHooks UserHooks
	// contains filtered or unexported fields
}

func NewUserStore

func NewUserStore(storage storage.Iface, maxUsers int) (*UserStore, error)

func NewUserStoreWithHooks

func NewUserStoreWithHooks(storage storage.Iface, maxUsers int, hooks UserHooks) (*UserStore, error)

func (*UserStore) AddUser

func (u *UserStore) AddUser(user User) (User, error)

func (*UserStore) AddUsers

func (u *UserStore) AddUsers(users []User) ([]User, error)

func (*UserStore) AuthUser

func (u *UserStore) AuthUser(login, password string) (User, bool)

func (*UserStore) DeleteUserByID

func (u *UserStore) DeleteUserByID(id string) error

func (*UserStore) DeleteUserByLogin

func (u *UserStore) DeleteUserByLogin(login string) error

func (*UserStore) Empty

func (u *UserStore) Empty() error

func (*UserStore) GetMaxUsers

func (u *UserStore) GetMaxUsers() int

func (*UserStore) GetUserByID

func (u *UserStore) GetUserByID(id string) (User, error)

func (*UserStore) GetUserByLogin

func (u *UserStore) GetUserByLogin(login string) (User, error)

func (*UserStore) GetUserByOIDCIDs

func (u *UserStore) GetUserByOIDCIDs(oidcIDs []string) (User, error)

func (*UserStore) ListUsers

func (u *UserStore) ListUsers() []User

func (*UserStore) LoginExists

func (u *UserStore) LoginExists(login string) bool

func (*UserStore) SaveUsers

func (u *UserStore) SaveUsers() error

func (*UserStore) UpdatePassword

func (u *UserStore) UpdatePassword(userID string, password string) error

func (*UserStore) UpdateUser

func (u *UserStore) UpdateUser(user User) error

func (*UserStore) UserCount

func (u *UserStore) UserCount() int

Jump to

Keyboard shortcuts

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