mirror of
https://github.com/goharbor/harbor.git
synced 2024-10-01 23:07:39 +02:00
parent
a6a4a1fc18
commit
84509fbb3e
@ -18,11 +18,11 @@ package models
|
|||||||
// LdapConf holds information about repository that accessed most
|
// LdapConf holds information about repository that accessed most
|
||||||
type LdapConf struct {
|
type LdapConf struct {
|
||||||
LdapURL string `json:"ldap_url"`
|
LdapURL string `json:"ldap_url"`
|
||||||
LdapSearchDn string `json:"ldap_searchdn"`
|
LdapSearchDn string `json:"ldap_search_dn"`
|
||||||
LdapSearchPwd string `json:"ldap_search_pwd"`
|
LdapSearchPassword string `json:"ldap_search_password"`
|
||||||
LdapBaseDn string `json:"ldap_basedn"`
|
LdapBaseDn string `json:"ldap_base_dn"`
|
||||||
LdapFilter string `json:"ldap_filter"`
|
LdapFilter string `json:"ldap_filter"`
|
||||||
LdapUID string `json:"ldap_uid"`
|
LdapUID string `json:"ldap_uid"`
|
||||||
LdapScope int `json:"ldap_scope"`
|
LdapScope int `json:"ldap_scope"`
|
||||||
LdapConnectTimeout int `json:"ldap_connect_timeout"`
|
LdapConnectionTimeout int `json:"ldap_connection_timeout"`
|
||||||
}
|
}
|
||||||
|
@ -80,8 +80,8 @@ func validateLdapReq(ldapConfs models.LdapConf) error {
|
|||||||
}
|
}
|
||||||
log.Debug("ldapURL:", ldapURL)
|
log.Debug("ldapURL:", ldapURL)
|
||||||
|
|
||||||
ldapConnectTimeout := ldapConfs.LdapConnectTimeout
|
ldapConnectionTimeout := ldapConfs.LdapConnectionTimeout
|
||||||
log.Debug("ldapConnectTimeout:", ldapConnectTimeout)
|
log.Debug("ldapConnectionTimeout:", ldapConnectionTimeout)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
||||||
@ -128,8 +128,8 @@ func connectTest(ldapConfs models.LdapConf) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Sets a Dial Timeout for LDAP
|
// Sets a Dial Timeout for LDAP
|
||||||
connectTimeout := ldapConfs.LdapConnectTimeout
|
connectionTimeout := ldapConfs.LdapConnectionTimeout
|
||||||
goldap.DefaultTimeout = time.Duration(connectTimeout) * time.Second
|
goldap.DefaultTimeout = time.Duration(connectionTimeout) * time.Second
|
||||||
|
|
||||||
switch protocol {
|
switch protocol {
|
||||||
case "ldap":
|
case "ldap":
|
||||||
@ -146,8 +146,8 @@ func connectTest(ldapConfs models.LdapConf) error {
|
|||||||
ldapSearchDn := ldapConfs.LdapSearchDn
|
ldapSearchDn := ldapConfs.LdapSearchDn
|
||||||
if ldapSearchDn != "" {
|
if ldapSearchDn != "" {
|
||||||
log.Debug("Search DN: ", ldapSearchDn)
|
log.Debug("Search DN: ", ldapSearchDn)
|
||||||
ldapSearchPwd := ldapConfs.LdapSearchPwd
|
ldapSearchPassword := ldapConfs.LdapSearchPassword
|
||||||
err = ldap.Bind(ldapSearchDn, ldapSearchPwd)
|
err = ldap.Bind(ldapSearchDn, ldapSearchPassword)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Debug("Bind search dn error", err)
|
log.Debug("Bind search dn error", err)
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user