Documentation
¶
Overview ¶
Package ldap provide functions & structure to query a LDAP ldap directory. For now, it's mainly tested again an MS Active Directory service, see README.md for more information.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewProvider ¶ added in v0.12.4
NewProvider creates a new LDAP authentication provider.
func SecurityProtocolName ¶ added in v0.12.4
func SecurityProtocolName(protocol SecurityProtocol) string
SecurityProtocolName returns the human-readable name for given security protocol.
Types ¶
type Config ¶ added in v0.12.4
type Config struct { Host string // LDAP host Port int // Port number SecurityProtocol SecurityProtocol SkipVerify bool BindDN string `ini:"bind_dn,omitempty"` // DN to bind with BindPassword string `ini:",omitempty"` // Bind DN password UserBase string `ini:",omitempty"` // Base search path for users UserDN string `ini:"user_dn,omitempty"` // Template for the DN of the user for simple auth AttributeUsername string // Username attribute AttributeName string // First name attribute AttributeSurname string // Surname attribute AttributeMail string // Email attribute AttributesInBind bool // Fetch attributes in bind context (not user) Filter string // Query filter to validate entry AdminFilter string // Query filter to check if user is admin GroupEnabled bool // Whether the group checking is enabled GroupDN string `ini:"group_dn"` // Group search base GroupFilter string // Group name filter GroupMemberUID string `ini:"group_member_uid"` // Group Attribute containing array of UserUID UserUID string `ini:"user_uid"` // User Attribute listed in group }
Config contains configuration for LDAP authentication.
⚠️ WARNING: Change to the field name must preserve the INI key name for backward compatibility.
func (*Config) SecurityProtocolName ¶ added in v0.12.4
type Provider ¶ added in v0.12.4
type Provider struct {
// contains filtered or unexported fields
}
Provider contains configuration of an LDAP authentication provider.
func (*Provider) Authenticate ¶ added in v0.12.4
func (p *Provider) Authenticate(login, password string) (*auth.ExternalAccount, error)
Authenticate queries if login/password is valid against the LDAP directory pool, and returns queried information when succeeded.
func (*Provider) SkipTLSVerify ¶ added in v0.12.4
type SecurityProtocol ¶
type SecurityProtocol int
SecurityProtocol is the security protocol when the authenticate provider talks to LDAP directory.
const ( SecurityProtocolUnencrypted SecurityProtocol = iota SecurityProtocolLDAPS SecurityProtocolStartTLS )
⚠️ WARNING: new type must be added at the end of list to maintain compatibility.