Documentation ¶
Overview ¶
Package users implements support for retrieving Users and their labels from external sources (LDAP, File).
Index ¶
- type UserLoader
- type UserLoaderFromFile
- type UserLoaderFromLDAP
- type UserLoaderMock
- func (loader *UserLoaderMock) AddUser(user *lang.User)
- func (loader *UserLoaderMock) Authenticate(name, password string) (*lang.User, error)
- func (loader *UserLoaderMock) LoadUserByName(name string) *lang.User
- func (loader *UserLoaderMock) LoadUsersAll() *lang.GlobalUsers
- func (loader *UserLoaderMock) Summary() string
- type UserLoaderMultipleSources
- func (loader *UserLoaderMultipleSources) Authenticate(name, password string) (*lang.User, error)
- func (loader *UserLoaderMultipleSources) LoadUserByName(name string) *lang.User
- func (loader *UserLoaderMultipleSources) LoadUsersAll() *lang.GlobalUsers
- func (loader *UserLoaderMultipleSources) Summary() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type UserLoader ¶
type UserLoader interface { // LoadUsersAll should load all users LoadUsersAll() *lang.GlobalUsers // LoadUserByName should load a single user by name. Name is not case sensitive. LoadUserByName(name string) *lang.User // Authenticate should authenticate a user by username/password. Name is not case sensitive. // If user exists and username/password is correct, it should be returned. // If a user doesn't exist or username/password is not correct, then nil should be returned together with an error. Authenticate(name, password string) (*lang.User, error) // Summary returns summary for the loader as string Summary() string }
UserLoader is an interface which allows aptomi to load user data from different sources (e.g. file, LDAP, AD, etc)
func NewUserLoaderFromFile ¶
func NewUserLoaderFromFile(fileName string, domainAdminOverrides map[string]bool) UserLoader
NewUserLoaderFromFile returns new UserLoaderFromFile
func NewUserLoaderFromLDAP ¶
func NewUserLoaderFromLDAP(cfg config.LDAP, domainAdminOverrides map[string]bool) UserLoader
NewUserLoaderFromLDAP returns new UserLoaderFromLDAP, given location with LDAP configuration file (with host/port and mapping)
type UserLoaderFromFile ¶
type UserLoaderFromFile struct {
// contains filtered or unexported fields
}
UserLoaderFromFile allows aptomi to load users from a file
func (*UserLoaderFromFile) Authenticate ¶
func (loader *UserLoaderFromFile) Authenticate(name, password string) (*lang.User, error)
Authenticate should authenticate a user by username/password. If user exists and username/password is correct, it should be returned. If a user doesn't exist or username/password is not correct, then nil should be returned together with an error.
func (*UserLoaderFromFile) LoadUserByName ¶
func (loader *UserLoaderFromFile) LoadUserByName(name string) *lang.User
LoadUserByName loads a single user by name
func (*UserLoaderFromFile) LoadUsersAll ¶
func (loader *UserLoaderFromFile) LoadUsersAll() *lang.GlobalUsers
LoadUsersAll loads all users
func (*UserLoaderFromFile) Summary ¶
func (loader *UserLoaderFromFile) Summary() string
Summary returns summary as string
type UserLoaderFromLDAP ¶
type UserLoaderFromLDAP struct {
// contains filtered or unexported fields
}
UserLoaderFromLDAP allows aptomi to load users from LDAP
func (*UserLoaderFromLDAP) Authenticate ¶
func (loader *UserLoaderFromLDAP) Authenticate(name, password string) (*lang.User, error)
Authenticate should authenticate a user by username/password. If user exists and username/password is correct, it should be returned. If a user doesn't exist or username/password is not correct, then nil should be returned together with an error.
func (*UserLoaderFromLDAP) LoadUserByName ¶
func (loader *UserLoaderFromLDAP) LoadUserByName(name string) *lang.User
LoadUserByName loads a single user by name
func (*UserLoaderFromLDAP) LoadUsersAll ¶
func (loader *UserLoaderFromLDAP) LoadUsersAll() *lang.GlobalUsers
LoadUsersAll loads all users
func (*UserLoaderFromLDAP) Summary ¶
func (loader *UserLoaderFromLDAP) Summary() string
Summary returns summary as string
type UserLoaderMock ¶
type UserLoaderMock struct {
// contains filtered or unexported fields
}
UserLoaderMock allows to mock user loader and use in-memory user storage
func NewUserLoaderMock ¶
func NewUserLoaderMock() *UserLoaderMock
NewUserLoaderMock returns new UserLoaderMock
func (*UserLoaderMock) AddUser ¶
func (loader *UserLoaderMock) AddUser(user *lang.User)
AddUser adds a user into the mock structure
func (*UserLoaderMock) Authenticate ¶
func (loader *UserLoaderMock) Authenticate(name, password string) (*lang.User, error)
Authenticate does nothing for mock
func (*UserLoaderMock) LoadUserByName ¶
func (loader *UserLoaderMock) LoadUserByName(name string) *lang.User
LoadUserByName loads a single user by Name
func (*UserLoaderMock) LoadUsersAll ¶
func (loader *UserLoaderMock) LoadUsersAll() *lang.GlobalUsers
LoadUsersAll loads all users
func (*UserLoaderMock) Summary ¶
func (loader *UserLoaderMock) Summary() string
Summary returns summary as string
type UserLoaderMultipleSources ¶
type UserLoaderMultipleSources struct {
// contains filtered or unexported fields
}
UserLoaderMultipleSources allows to combine different user sources into a single loader
func NewUserLoaderMultipleSources ¶
func NewUserLoaderMultipleSources(loaders []UserLoader) *UserLoaderMultipleSources
NewUserLoaderMultipleSources returns new UserLoaderMultipleSources
func (*UserLoaderMultipleSources) Authenticate ¶
func (loader *UserLoaderMultipleSources) Authenticate(name, password string) (*lang.User, error)
Authenticate authenticate a user by username/password by trying all available user data sources.
func (*UserLoaderMultipleSources) LoadUserByName ¶
func (loader *UserLoaderMultipleSources) LoadUserByName(name string) *lang.User
LoadUserByName loads a single user by name
func (*UserLoaderMultipleSources) LoadUsersAll ¶
func (loader *UserLoaderMultipleSources) LoadUsersAll() *lang.GlobalUsers
LoadUsersAll loads all users
func (*UserLoaderMultipleSources) Summary ¶
func (loader *UserLoaderMultipleSources) Summary() string
Summary returns summary as string