Documentation ¶
Overview ¶
Package authentication is a generated GoMock package.
Index ¶
- Constants
- Variables
- func CheckPassword(password string, hash string) (bool, error)
- func HashPassword(password string, salt string) string
- func RandomString(n int) string
- type DatabaseModel
- type FileUserProvider
- type LDAPConnection
- type LDAPConnectionFactory
- type LDAPConnectionFactoryImpl
- type LDAPConnectionImpl
- type LDAPUserProvider
- type Level
- type MockLDAPConnection
- func (m *MockLDAPConnection) Bind(username, password string) error
- func (m *MockLDAPConnection) Close()
- func (m *MockLDAPConnection) EXPECT() *MockLDAPConnectionMockRecorder
- func (m *MockLDAPConnection) Modify(modifyRequest *ldap_v3.ModifyRequest) error
- func (m *MockLDAPConnection) Search(searchRequest *ldap_v3.SearchRequest) (*ldap_v3.SearchResult, error)
- type MockLDAPConnectionFactory
- type MockLDAPConnectionFactoryMockRecorder
- type MockLDAPConnectionMockRecorder
- func (mr *MockLDAPConnectionMockRecorder) Bind(username, password interface{}) *gomock.Call
- func (mr *MockLDAPConnectionMockRecorder) Close() *gomock.Call
- func (mr *MockLDAPConnectionMockRecorder) Modify(modifyRequest interface{}) *gomock.Call
- func (mr *MockLDAPConnectionMockRecorder) Search(searchRequest interface{}) *gomock.Call
- type PasswordHash
- type UserDetails
- type UserDetailsModel
- type UserProvider
Constants ¶
const ( // TOTP Method using Time-Based One-Time Password applications like Google Authenticator TOTP = "totp" // U2F Method using U2F devices like Yubikeys U2F = "u2f" // Push Method using Duo application to receive push notifications. Push = "mobile_push" )
Variables ¶
var PossibleMethods = []string{TOTP, U2F, Push}
PossibleMethods is the set of all possible 2FA methods.
Functions ¶
func CheckPassword ¶
CheckPassword check a password against a hash.
func HashPassword ¶
HashPassword generate a salt and hash the password with the salt and a constant number of rounds.
func RandomString ¶
RandomString generate a random string of n characters.
Types ¶
type DatabaseModel ¶
type DatabaseModel struct {
Users map[string]UserDetailsModel `yaml:"users" valid:"required"`
}
DatabaseModel is the model of users file database.
type FileUserProvider ¶
type FileUserProvider struct {
// contains filtered or unexported fields
}
FileUserProvider is a provider reading details from a file.
func NewFileUserProvider ¶
func NewFileUserProvider(filepath string) *FileUserProvider
NewFileUserProvider creates a new instance of FileUserProvider.
func (*FileUserProvider) CheckUserPassword ¶
func (p *FileUserProvider) CheckUserPassword(username string, password string) (bool, error)
CheckUserPassword checks if provided password matches for the given user.
func (*FileUserProvider) GetDetails ¶
func (p *FileUserProvider) GetDetails(username string) (*UserDetails, error)
GetDetails retrieve the groups a user belongs to.
func (*FileUserProvider) UpdatePassword ¶
func (p *FileUserProvider) UpdatePassword(username string, newPassword string) error
UpdatePassword update the password of the given user.
type LDAPConnection ¶
type LDAPConnection interface { Bind(username, password string) error Close() Search(searchRequest *ldap.SearchRequest) (*ldap.SearchResult, error) Modify(modifyRequest *ldap.ModifyRequest) error }
LDAPConnection interface representing a connection to the ldap.
type LDAPConnectionFactory ¶
type LDAPConnectionFactory interface { DialTLS(network, addr string, config *tls.Config) (LDAPConnection, error) Dial(network, addr string) (LDAPConnection, error) }
LDAPConnectionFactory an interface of factory of ldap connections
type LDAPConnectionFactoryImpl ¶
type LDAPConnectionFactoryImpl struct{}
LDAPConnectionFactoryImpl the production implementation of an ldap connection factory.
func NewLDAPConnectionFactoryImpl ¶
func NewLDAPConnectionFactoryImpl() *LDAPConnectionFactoryImpl
NewLDAPConnectionFactoryImpl create a concrete ldap connection factory
func (*LDAPConnectionFactoryImpl) Dial ¶
func (lcf *LDAPConnectionFactoryImpl) Dial(network, addr string) (LDAPConnection, error)
Dial contact ldap server over raw tcp.
func (*LDAPConnectionFactoryImpl) DialTLS ¶
func (lcf *LDAPConnectionFactoryImpl) DialTLS(network, addr string, config *tls.Config) (LDAPConnection, error)
DialTLS contact ldap server over TLS.
type LDAPConnectionImpl ¶
type LDAPConnectionImpl struct {
// contains filtered or unexported fields
}
LDAPConnectionImpl the production implementation of an ldap connection
func NewLDAPConnectionImpl ¶
func NewLDAPConnectionImpl(conn *ldap.Conn) *LDAPConnectionImpl
NewLDAPConnectionImpl create a new ldap connection
func (*LDAPConnectionImpl) Bind ¶
func (lc *LDAPConnectionImpl) Bind(username, password string) error
func (*LDAPConnectionImpl) Close ¶
func (lc *LDAPConnectionImpl) Close()
func (*LDAPConnectionImpl) Modify ¶
func (lc *LDAPConnectionImpl) Modify(modifyRequest *ldap.ModifyRequest) error
func (*LDAPConnectionImpl) Search ¶
func (lc *LDAPConnectionImpl) Search(searchRequest *ldap.SearchRequest) (*ldap.SearchResult, error)
type LDAPUserProvider ¶
type LDAPUserProvider struct {
// contains filtered or unexported fields
}
LDAPUserProvider is a provider using a LDAP or AD as a user database.
func NewLDAPUserProvider ¶
func NewLDAPUserProvider(configuration schema.LDAPAuthenticationBackendConfiguration) *LDAPUserProvider
NewLDAPUserProvider creates a new instance of LDAPUserProvider.
func NewLDAPUserProviderWithFactory ¶
func NewLDAPUserProviderWithFactory(configuration schema.LDAPAuthenticationBackendConfiguration, connectionFactory LDAPConnectionFactory) *LDAPUserProvider
func (*LDAPUserProvider) CheckUserPassword ¶
func (p *LDAPUserProvider) CheckUserPassword(username string, password string) (bool, error)
CheckUserPassword checks if provided password matches for the given user.
func (*LDAPUserProvider) GetDetails ¶
func (p *LDAPUserProvider) GetDetails(username string) (*UserDetails, error)
GetDetails retrieve the groups a user belongs to.
func (*LDAPUserProvider) UpdatePassword ¶
func (p *LDAPUserProvider) UpdatePassword(username string, newPassword string) error
UpdatePassword update the password of the given user.
type MockLDAPConnection ¶
type MockLDAPConnection struct {
// contains filtered or unexported fields
}
MockLDAPConnection is a mock of LDAPConnection interface
func NewMockLDAPConnection ¶
func NewMockLDAPConnection(ctrl *gomock.Controller) *MockLDAPConnection
NewMockLDAPConnection creates a new mock instance
func (*MockLDAPConnection) Bind ¶
func (m *MockLDAPConnection) Bind(username, password string) error
Bind mocks base method
func (*MockLDAPConnection) EXPECT ¶
func (m *MockLDAPConnection) EXPECT() *MockLDAPConnectionMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockLDAPConnection) Modify ¶
func (m *MockLDAPConnection) Modify(modifyRequest *ldap_v3.ModifyRequest) error
Modify mocks base method
func (*MockLDAPConnection) Search ¶
func (m *MockLDAPConnection) Search(searchRequest *ldap_v3.SearchRequest) (*ldap_v3.SearchResult, error)
Search mocks base method
type MockLDAPConnectionFactory ¶
type MockLDAPConnectionFactory struct {
// contains filtered or unexported fields
}
MockLDAPConnectionFactory is a mock of LDAPConnectionFactory interface
func NewMockLDAPConnectionFactory ¶
func NewMockLDAPConnectionFactory(ctrl *gomock.Controller) *MockLDAPConnectionFactory
NewMockLDAPConnectionFactory creates a new mock instance
func (*MockLDAPConnectionFactory) Dial ¶
func (m *MockLDAPConnectionFactory) Dial(network, addr string) (LDAPConnection, error)
Dial mocks base method
func (*MockLDAPConnectionFactory) DialTLS ¶
func (m *MockLDAPConnectionFactory) DialTLS(network, addr string, config *tls.Config) (LDAPConnection, error)
DialTLS mocks base method
func (*MockLDAPConnectionFactory) EXPECT ¶
func (m *MockLDAPConnectionFactory) EXPECT() *MockLDAPConnectionFactoryMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
type MockLDAPConnectionFactoryMockRecorder ¶
type MockLDAPConnectionFactoryMockRecorder struct {
// contains filtered or unexported fields
}
MockLDAPConnectionFactoryMockRecorder is the mock recorder for MockLDAPConnectionFactory
func (*MockLDAPConnectionFactoryMockRecorder) Dial ¶
func (mr *MockLDAPConnectionFactoryMockRecorder) Dial(network, addr interface{}) *gomock.Call
Dial indicates an expected call of Dial
func (*MockLDAPConnectionFactoryMockRecorder) DialTLS ¶
func (mr *MockLDAPConnectionFactoryMockRecorder) DialTLS(network, addr, config interface{}) *gomock.Call
DialTLS indicates an expected call of DialTLS
type MockLDAPConnectionMockRecorder ¶
type MockLDAPConnectionMockRecorder struct {
// contains filtered or unexported fields
}
MockLDAPConnectionMockRecorder is the mock recorder for MockLDAPConnection
func (*MockLDAPConnectionMockRecorder) Bind ¶
func (mr *MockLDAPConnectionMockRecorder) Bind(username, password interface{}) *gomock.Call
Bind indicates an expected call of Bind
func (*MockLDAPConnectionMockRecorder) Close ¶
func (mr *MockLDAPConnectionMockRecorder) Close() *gomock.Call
Close indicates an expected call of Close
func (*MockLDAPConnectionMockRecorder) Modify ¶
func (mr *MockLDAPConnectionMockRecorder) Modify(modifyRequest interface{}) *gomock.Call
Modify indicates an expected call of Modify
func (*MockLDAPConnectionMockRecorder) Search ¶
func (mr *MockLDAPConnectionMockRecorder) Search(searchRequest interface{}) *gomock.Call
Search indicates an expected call of Search
type PasswordHash ¶
type PasswordHash struct { // The number of rounds. Rounds int // The salt with a max size of 16 characters for SHA512. Salt string // The password hash. Hash string }
PasswordHash represents all characteristics of a password hash. Authelia only supports salted SHA512 method, i.e., $6$ mode.
type UserDetails ¶
UserDetails represent the details retrieved for a given user.
type UserDetailsModel ¶
type UserDetailsModel struct { HashedPassword string `yaml:"password" valid:"required"` Email string `yaml:"email"` Groups []string `yaml:"groups"` }
UserDetailsModel is the model of user details in the file database.
type UserProvider ¶
type UserProvider interface { CheckUserPassword(username string, password string) (bool, error) GetDetails(username string) (*UserDetails, error) UpdatePassword(username string, newPassword string) error }
UserProvider is the interface for checking user password and gathering user details.