Documentation ¶
Index ¶
- func Authenticate(config *Config, username, password string) (bool, error)
- func AuthenticateExtended(config *Config, username, password string, attrs, groups []string) (status bool, entry *ldap.Entry, userGroups []string, err error)
- func UpdatePassword(config *Config, username, oldPasswd, newPasswd string) error
- type Config
- type Conn
- func (c *Conn) Bind(upn, password string) (bool, error)
- func (c *Conn) GetAttributes(attr, value string, attrs []string) (*ldap.Entry, error)
- func (c *Conn) GetDN(attr, value string) (string, error)
- func (c *Conn) GroupDN(group string) (string, error)
- func (c *Conn) ModifyDNPassword(dn, newPasswd string) error
- func (c *Conn) ObjectGroups(attr, value string, groups []string) ([]string, error)
- func (c *Conn) Search(filter string, attrs []string, sizeLimit int) ([]*ldap.Entry, error)
- func (c *Conn) SearchOne(filter string, attrs []string) (*ldap.Entry, error)
- type SecurityType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Authenticate ¶
Authenticate checks if the given credentials are valid, or returns an error if one occurred. username may be either the sAMAccountName or the userPrincipalName.
func AuthenticateExtended ¶
func AuthenticateExtended(config *Config, username, password string, attrs, groups []string) (status bool, entry *ldap.Entry, userGroups []string, err error)
AuthenticateExtended checks if the given credentials are valid, or returns an error if one occurred. username may be either the sAMAccountName or the userPrincipalName. entry is the *ldap.Entry that holds the DN and any request attributes of the user. If groups is non-empty, userGroups will hold which of those groups the user is a member of. groups can be a list of groups referenced by DN or cn and the format provided will be the format returned.
func UpdatePassword ¶
UpdatePassword checks if the given credentials are valid and updates the password if they are, or returns an error if one occurred. UpdatePassword is used for users resetting their own password.
Types ¶
type Config ¶
type Config struct { Server string Port int BaseDN string Security SecurityType }
Config contains settings for connecting to an Active Directory server.
func (*Config) Connect ¶
Connect returns an open connection to an Active Directory server or an error if one occurred.
type Conn ¶
Conn represents an Active Directory connection.
func (*Conn) Bind ¶
Bind authenticates the connection with the given userPrincipalName and password and returns the result or an error if one occurred.
func (*Conn) GetAttributes ¶
GetAttributes returns the *ldap.Entry with the given attributes for the object with the given attribute value or an error if one occurred.
func (*Conn) GetDN ¶
GetDN returns the DN for the object with the given attribute value or an error if one occurred.
func (*Conn) GroupDN ¶
GroupDN returns the DN of the group with the given cn or an error if one occurred.
func (*Conn) ModifyDNPassword ¶
ModifyDNPassword sets a new password for the given user or returns an error if one occurred. ModifyDNPassword is used for resetting user passwords using administrative privileges.
func (*Conn) ObjectGroups ¶
ObjectGroups returns which of the given groups (referenced by DN) the object with the given attribute value is in, if any, or an error if one occurred.
type SecurityType ¶
type SecurityType int
SecurityType specifies the type of security to use when connecting to an Active Directory Server.
const ( SecurityNone SecurityType = iota SecurityTLS SecurityStartTLS )
Security will default to SecurityNone if not given.