{"modulePath":"github.com/RedAFD/code-core","version":"v1.8.3","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package ldap\n\nPackage ldap provide functions \u0026 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\n\n## Types\n\n```go\ntype SearchResult struct {\n\tUsername     string   // Username\n\tName         string   // Name\n\tSurname      string   // Surname\n\tMail         string   // E-mail address\n\tSSHPublicKey []string // SSH Public Key\n\tIsAdmin      bool     // if user is administrator\n}\n```\nSearchResult : user data\n\n```go\ntype SecurityProtocol int\n```\nSecurityProtocol protocol type\n\n```go\nconst (\n\tSecurityProtocolUnencrypted SecurityProtocol = iota\n\tSecurityProtocolLDAPS\n\tSecurityProtocolStartTLS\n)\n```\nNote: new type must be added at the end of list to maintain compatibility.\n\n```go\ntype Source struct {\n\tName                  string // canonical name (ie. corporate.ad)\n\tHost                  string // LDAP host\n\tPort                  int    // port number\n\tSecurityProtocol      SecurityProtocol\n\tSkipVerify            bool\n\tBindDN                string // DN to bind with\n\tBindPassword          string // Bind DN password\n\tUserBase              string // Base search path for users\n\tUserDN                string // Template for the DN of the user for simple auth\n\tAttributeUsername     string // Username attribute\n\tAttributeName         string // First name attribute\n\tAttributeSurname      string // Surname attribute\n\tAttributeMail         string // E-mail attribute\n\tAttributesInBind      bool   // fetch attributes in bind context (not user)\n\tAttributeSSHPublicKey string // LDAP SSH Public Key attribute\n\tSearchPageSize        uint32 // Search with paging page size\n\tFilter                string // Query filter to validate entry\n\tAdminFilter           string // Query filter to check if user is admin\n\tEnabled               bool   // if this source is disabled\n}\n```\nSource Basic LDAP authentication service\n\n```go\nfunc (ls *Source) SearchEntries() []*SearchResult\n```\nSearchEntries : search an LDAP source for all users matching userFilter\n\n```go\nfunc (ls *Source) SearchEntry(name, passwd string, directBind bool) *SearchResult\n```\nSearchEntry : search an LDAP source if an entry (name, passwd) is valid and in the specific filter\n\n```go\nfunc (ls *Source) UsePagedSearch() bool\n```\nUsePagedSearch returns if need to use paged search\n\n","path":"github.com/RedAFD/code-core/modules/auth/ldap","name":"ldap","synopsis":"Package ldap provide functions \u0026 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","isRedistributable":true}
