gitea: Index | Files

package ldap

import ""

Package ldap provide functions & structure to query a LDAP ldap directory For now, it's mainly tested again an MS Active Directory service, see for more information


Package Files


type SearchResult Uses

type SearchResult struct {
    Username     string   // Username
    Name         string   // Name
    Surname      string   // Surname
    Mail         string   // E-mail address
    SSHPublicKey []string // SSH Public Key
    IsAdmin      bool     // if user is administrator
    IsRestricted bool     // if user is restricted

SearchResult : user data

type SecurityProtocol Uses

type SecurityProtocol int

SecurityProtocol protocol type

const (
    SecurityProtocolUnencrypted SecurityProtocol = iota

Note: new type must be added at the end of list to maintain compatibility.

type Source Uses

type Source struct {
    Name                  string // canonical name (ie.
    Host                  string // LDAP host
    Port                  int    // port number
    SecurityProtocol      SecurityProtocol
    SkipVerify            bool
    BindDN                string // DN to bind with
    BindPassword          string // Bind DN password
    UserBase              string // Base search path for users
    UserDN                string // 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 // E-mail attribute
    AttributesInBind      bool   // fetch attributes in bind context (not user)
    AttributeSSHPublicKey string // LDAP SSH Public Key attribute
    SearchPageSize        uint32 // Search with paging page size
    Filter                string // Query filter to validate entry
    AdminFilter           string // Query filter to check if user is admin
    RestrictedFilter      string // Query filter to check if user is restricted
    Enabled               bool   // if this source is disabled
    AllowDeactivateAll    bool   // Allow an empty search response to deactivate all users from this source
    GroupsEnabled         bool   // if the group checking is enabled
    GroupDN               string // Group Search Base
    GroupFilter           string // Group Name Filter
    GroupMemberUID        string // Group Attribute containing array of UserUID
    UserUID               string // User Attribute listed in Group

Source Basic LDAP authentication service

func (*Source) SearchEntries Uses

func (ls *Source) SearchEntries() ([]*SearchResult, error)

SearchEntries : search an LDAP source for all users matching userFilter

func (*Source) SearchEntry Uses

func (ls *Source) SearchEntry(name, passwd string, directBind bool) *SearchResult

SearchEntry : search an LDAP source if an entry (name, passwd) is valid and in the specific filter

func (*Source) UsePagedSearch Uses

func (ls *Source) UsePagedSearch() bool

UsePagedSearch returns if need to use paged search

Package ldap imports 5 packages (graph) and is imported by 55 packages. Updated 2020-10-19. Refresh now. Tools for package owners.