Documentation ¶
Index ¶
- type AuthServer
- type Authenticator
- func (sa *Authenticator) AuthenticateUser(userInput, passwordInput string) (*jwt.UserClaims, int, error)
- func (sa *Authenticator) ConfigureBindCredentials(username, password string) error
- func (sa *Authenticator) ConfigureRealm(realm string) error
- func (sa *Authenticator) ConfigureSearch(attr UserAttributes, searchBaseDN string, searchFilter string) error
- func (sa *Authenticator) ConfigureServers(servers []AuthServer) error
- func (sa *Authenticator) ConfigureTrustedAuthorities(authorities []string) error
- func (sa *Authenticator) ConfigureUserGroups(groups []UserGroup) error
- type Backend
- func (b *Backend) Authenticate(opts map[string]interface{}) (map[string]interface{}, error)
- func (b *Backend) ConfigureAuthenticator() error
- func (b *Backend) ConfigureLogger(logger *zap.Logger) error
- func (b *Backend) ConfigureTokenProvider(upstream *jwt.CommonTokenConfig) error
- func (b *Backend) GetMethod() string
- func (b *Backend) GetName() string
- func (b *Backend) GetRealm() string
- func (b *Backend) Validate() error
- func (b *Backend) ValidateConfig() error
- type UserAttributes
- type UserGroup
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthServer ¶
type AuthServer struct { Address string `json:"addr,omitempty"` URL *url.URL `json:"-"` Port string `json:"-"` IgnoreCertErrors bool `json:"ignore_cert_errors,omitempty"` Timeout int `json:"timeout,omitempty"` }
AuthServer represents an instance of LDAP server.
type Authenticator ¶
type Authenticator struct {
// contains filtered or unexported fields
}
Authenticator represents database connector.
func NewAuthenticator ¶
func NewAuthenticator() *Authenticator
NewAuthenticator returns an instance of Authenticator.
func (*Authenticator) AuthenticateUser ¶
func (sa *Authenticator) AuthenticateUser(userInput, passwordInput string) (*jwt.UserClaims, int, error)
AuthenticateUser checks the database for the presence of a username/email and password and returns user claims.
func (*Authenticator) ConfigureBindCredentials ¶
func (sa *Authenticator) ConfigureBindCredentials(username, password string) error
ConfigureBindCredentials configures user credentials for LDAP binding.
func (*Authenticator) ConfigureRealm ¶
func (sa *Authenticator) ConfigureRealm(realm string) error
ConfigureRealm configures a domain name (realm) associated with the instance of authenticator.
func (*Authenticator) ConfigureSearch ¶
func (sa *Authenticator) ConfigureSearch(attr UserAttributes, searchBaseDN string, searchFilter string) error
ConfigureSearch configures base DN, search filter, attributes for LDAP queries.
func (*Authenticator) ConfigureServers ¶
func (sa *Authenticator) ConfigureServers(servers []AuthServer) error
ConfigureServers configures the addresses of LDAP servers.
func (*Authenticator) ConfigureTrustedAuthorities ¶ added in v1.1.11
func (sa *Authenticator) ConfigureTrustedAuthorities(authorities []string) error
ConfigureTrustedAuthorities configured trusted certificate authorities, if any.
func (*Authenticator) ConfigureUserGroups ¶
func (sa *Authenticator) ConfigureUserGroups(groups []UserGroup) error
ConfigureUserGroups configures user group bindings for LDAP searching.
type Backend ¶
type Backend struct { Name string `json:"name,omitempty"` Method string `json:"method,omitempty"` Realm string `json:"realm,omitempty"` Servers []AuthServer `json:"servers,omitempty"` BindUsername string `json:"username,omitempty"` BindPassword string `json:"password,omitempty"` Attributes UserAttributes `json:"attributes,omitempty"` SearchBaseDN string `json:"search_base_dn,omitempty"` SearchFilter string `json:"search_filter,omitempty"` Groups []UserGroup `json:"groups,omitempty"` TrustedAuthorities []string `json:"trusted_authorities,omitempty"` TokenProvider *jwt.CommonTokenConfig `json:"-"` Authenticator *Authenticator `json:"-"` // contains filtered or unexported fields }
Backend represents authentication provider with LDAP backend.
func NewDatabaseBackend ¶
func NewDatabaseBackend() *Backend
NewDatabaseBackend return an instance of authentication provider with LDAP backend.
func (*Backend) Authenticate ¶
Authenticate performs authentication.
func (*Backend) ConfigureAuthenticator ¶
ConfigureAuthenticator configures backend for .
func (*Backend) ConfigureLogger ¶
ConfigureLogger configures backend with the same logger as its user.
func (*Backend) ConfigureTokenProvider ¶
ConfigureTokenProvider configures TokenProvider.
func (*Backend) GetMethod ¶ added in v1.1.3
GetMethod returns the authentication method associated with this backend.
func (*Backend) ValidateConfig ¶
ValidateConfig checks whether Backend has mandatory configuration.
type UserAttributes ¶
type UserAttributes struct { Name string `json:"name,omitempty"` Surname string `json:"surname,omitempty"` Username string `json:"username,omitempty"` MemberOf string `json:"member_of,omitempty"` Email string `json:"email,omitempty"` }
UserAttributes represent the mapping of LDAP attributes to JWT fields.