Documentation ¶
Index ¶
- Variables
- func ParseTicks(ticks string) (time.Time, error)
- func TicksToTime(ticks int64) time.Time
- type ADConf
- type Client
- func (c *Client) Search(cfg *ADConf, baseDN string, filters map[*Field][]string) ([]*Entry, error)
- func (c *Client) UpdateEntry(cfg *ADConf, baseDN string, filters map[*Field][]string, ...) error
- func (c *Client) UpdatePassword(cfg *ADConf, baseDN string, filters map[*Field][]string, newPassword string) error
- type Entry
- type Field
Constants ¶
This section is empty.
Variables ¶
var FieldRegistry = newFieldRegistry()
FieldRegistry is designed to look and feel like an enum from another language like Python.
Example: Accessing constants
FieldRegistry.AccountExpires FieldRegistry.BadPasswordCount
Example: Utility methods
FieldRegistry.List() FieldRegistry.Parse("givenName")
Functions ¶
func ParseTicks ¶
ParseTicks parses dates represented as Active Directory LargeInts into times. Not all time fields are represented this way, so be sure to test that your particular time returns expected results. Some time fields represented as LargeInts include accountExpires, lastLogon, lastLogonTimestamp, and pwdLastSet. More: https://social.technet.microsoft.com/wiki/contents/articles/31135.active-directory-large-integer-attributes.aspx
func TicksToTime ¶
TicksToTime converts an ActiveDirectory time in ticks to a time. This algorithm is summarized as:
Many dates are saved in Active Directory as Large Integer values. These attributes represent dates as the number of 100-nanosecond intervals since 12:00 AM January 1, 1601. 100-nanosecond intervals, equal to 0.0000001 seconds, are also called ticks. Dates in Active Directory are always saved in Coordinated Universal Time, or UTC. More: https://social.technet.microsoft.com/wiki/contents/articles/31135.active-directory-large-integer-attributes.aspx
If we directly follow the above algorithm we encounter time.Duration limits of 290 years and int overflow issues. Thus below, we carefully sidestep those.
Types ¶
type ADConf ¶
type ADConf struct { *ldaputil.ConfigEntry LastBindPassword string `json:"last_bind_password"` LastBindPasswordRotation time.Time `json:"last_bind_password_rotation"` }
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) UpdateEntry ¶
func (*Client) UpdatePassword ¶
func (c *Client) UpdatePassword(cfg *ADConf, baseDN string, filters map[*Field][]string, newPassword string) error
UpdatePassword uses a Modify call under the hood because Active Directory doesn't recognize the passwordModify method. See https://github.com/go-ldap/ldap/issues/106 for more.