LDAP: Added reload endpoint for LDAP config (#15470)

* 4843 - Added reload endpoint for LDAP config

closes #4843

* Refactor to make the reload work after master drifted
This commit is contained in:
Samuel
2019-05-03 22:53:07 +10:00
committed by Andrej Ocenas
parent 16d5df1cba
commit 846b9327a5
8 changed files with 90 additions and 37 deletions
+6 -3
View File
@@ -22,8 +22,8 @@ const (
)
var (
readLDAPConfig = ldap.ReadConfig
isLDAPEnabled = ldap.IsEnabled
getLDAPConfig = ldap.GetConfig
isLDAPEnabled = ldap.IsEnabled
)
// AuthProxy struct
@@ -219,7 +219,10 @@ func (auth *AuthProxy) GetUserIDViaLDAP() (int64, *Error) {
Username: auth.header,
}
config := readLDAPConfig()
config, err := getLDAPConfig()
if err != nil {
return 0, newError("Failed to get LDAP config", nil)
}
if len(config.Servers) == 0 {
return 0, newError("No LDAP servers available", nil)
}