mirror of
https://github.com/steveiliop56/tinyauth.git
synced 2026-01-18 21:32:28 +00:00
fix: review feedback
This commit is contained in:
@@ -141,9 +141,13 @@ func (auth *AuthService) GetLocalUser(username string) config.User {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (auth *AuthService) GetLdapUser(userDN string) (config.LdapUser, error) {
|
func (auth *AuthService) GetLdapUser(userDN string) (config.LdapUser, error) {
|
||||||
auth.ldapGroupsMutex.Lock()
|
if auth.ldap == nil {
|
||||||
|
return config.LdapUser{}, errors.New("LDAP service not initialized")
|
||||||
|
}
|
||||||
|
|
||||||
|
auth.ldapGroupsMutex.RLock()
|
||||||
entry, exists := auth.ldapGroupsCache[userDN]
|
entry, exists := auth.ldapGroupsCache[userDN]
|
||||||
auth.ldapGroupsMutex.Unlock()
|
auth.ldapGroupsMutex.RUnlock()
|
||||||
|
|
||||||
if exists && time.Now().Before(entry.Expires) {
|
if exists && time.Now().Before(entry.Expires) {
|
||||||
return config.LdapUser{
|
return config.LdapUser{
|
||||||
|
|||||||
Reference in New Issue
Block a user