Documentation
¶
Overview ¶
Copyright 2020-2024 NGR Softlab
Copyright 2020-2024 NGR Softlab ¶
Copyright 2020-2024 NGR Softlab
Index ¶
- Constants
- Variables
- func TestBaseDn(userName, passWord, host string, port interface{}, baseDn string, ...) error
- func TestBaseDnWithTLSConfig(userName, passWord, host string, port interface{}, baseDn string, ...) error
- func TryAccess(userName, passWord, host string, port interface{}, useTls bool) error
- func TryAccessWithTLSConfig(userName, passWord, host string, port interface{}, tlsCfg *tls.Config) error
- type ADStruct
- type GroupInfo
- type LdapConn
- func (conn *LdapConn) Close()
- func (conn *LdapConn) GetGroupUsers(group string) (res []UserShortInfo, err error)
- func (conn *LdapConn) GetRecursiveSearchResult(prevLevel *[]GroupInfo, level int) *[]GroupInfo
- func (conn *LdapConn) GetRootGroups(baseDn string) (res []GroupInfo, err error)
- func (conn *LdapConn) GetStruct(baseDn string) (res ADStruct, err error)
- func (conn *LdapConn) GetSubGroups(group string, level int) (res []GroupInfo, err error)
- func (conn *LdapConn) GetUserInfo(userName, baseDn string) (res UserFullInfo, err error)
- type LdapConnOptions
- type UserFullInfo
- type UserShortInfo
Constants ¶
View Source
const (
// DepthOfLdapSearch For get AD struct
DepthOfLdapSearch = 4
)
Variables ¶
View Source
var ( ADUserAttrs = []string{ "cn", "department", "mobile", "mail", "title", "thumbnailPhoto", "manager", "telephoneNumber", "streetAddress", "l", "physicalDeliveryOfficeName", "postalCode", "co", "company", } ADGroupUserAttrs = []string{"cn", "mail", "userPrincipalName", "title", "department"} ADGroupAttrs = []string{"name", "ou", "distinguishedName"} )
Functions ¶
func TestBaseDn ¶
func TestBaseDn(userName, passWord, host string, port interface{}, baseDn string, useTls, openLdap bool) error
TestBaseDn Test search in AD baseDn path (conn with InsecureSkipVerify: true)
func TestBaseDnWithTLSConfig ¶ added in v2.0.5
func TestBaseDnWithTLSConfig(userName, passWord, host string, port interface{}, baseDn string, tlsCfg *tls.Config, openLdap bool) error
TestBaseDnWithTLSConfig Test search in AD baseDn path with passed tls config
Types ¶
type GroupInfo ¶
type GroupInfo struct {
Name string `json:"name"`
DName string `json:"distinguishedName"` // long department name
Ou string `json:"ou"`
Has []GroupInfo `json:"has"` // list of subdirs (group children)
}
GroupInfo Department obj from AD struct.
type LdapConn ¶
func NewLdapConn ¶
func NewLdapConn(userName, passWord, host string, port interface{}, useTls bool, options ...LdapConnOptions) (*LdapConn, error)
NewLdapConn - create new conn (with InsecureSkipVerify: true)
func NewLdapConnWithTLSConfig ¶ added in v2.0.5
func NewLdapConnWithTLSConfig(userName, passWord, host string, port interface{}, tlsCfg *tls.Config, options ...LdapConnOptions) (*LdapConn, error)
NewLdapConnWithTLSConfig - create new conn with passed tls config
func (*LdapConn) GetGroupUsers ¶
func (conn *LdapConn) GetGroupUsers(group string) (res []UserShortInfo, err error)
GetGroupUsers
func (*LdapConn) GetRecursiveSearchResult ¶
GetRecursiveSearchResult - run recursive search in AD (group->subgroup->etc.), return groups tree info
func (*LdapConn) GetRootGroups ¶
GetRootGroups Reading root AD folders (ou)
func (*LdapConn) GetSubGroups ¶
GetSubGroups Reading AD subFolders in group
func (*LdapConn) GetUserInfo ¶
func (conn *LdapConn) GetUserInfo(userName, baseDn string) (res UserFullInfo, err error)
GetUserInfo - get user info
type LdapConnOptions ¶
type LdapConnOptions struct {
OpenLDAP bool
}
type UserFullInfo ¶
type UserFullInfo struct {
CN string `json:"cn"` // full name
Department string `json:"department"`
Mobile string `json:"mobile"` // mobile phone
Mail string `json:"mail"` // email
Title string `json:"title"` // user title
Photo string `json:"thumbnailPhoto"` // bad photo from AD
Company string `json:"company"`
Address string `json:"address"`
City string `json:"city"`
Index string `json:"index"`
Country string `json:"country"`
Room string `json:"room"`
Phone string `json:"phone"`
Manager string `json:"manager"`
}
UserFullInfo User full info from AD struct
Click to show internal directories.
Click to hide internal directories.