Skip to content

Commit

Permalink
Minor fixes to #43
Browse files Browse the repository at this point in the history
  • Loading branch information
wiltonsr committed Jul 27, 2023
1 parent f3ed0c6 commit 09175bf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/dynamic-conf/ldapAuth-conf.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ LogLevel = "DEBUG"
Port = "389"
Url = "ldap://ldap.forumsys.com"
AllowedGroups = ["ou=mathematicians,dc=example,dc=com","ou=italians,ou=scientists,dc=example,dc=com"]
AllowedUsers = ["euler", "euclid"]
AllowedUsers = ["euler", "uid=euclid,dc=example,dc=com"]
# SearchFilter must escape curly braces when using toml file
# https://toml.io/en/v1.0.0#string
# SearchFilter = '''(\{\{.Attribute\}\}=\{\{.Username\}\})'''
2 changes: 1 addition & 1 deletion examples/dynamic-conf/ldapAuth-conf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ http:
- ou=italians,ou=scientists,dc=example,dc=com
AllowedUsers:
- euler
- euclid
- uid=euclid,dc=example,dc=com
# SearchFilter must escape curly braces when using yml file
# https://yaml.org/spec/1.1/#id872840
# SearchFilter: (\{\{.Attribute\}\}=\{\{.Username\}\})
6 changes: 3 additions & 3 deletions ldapauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ func (la *LdapAuth) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
defer conn.Close()
LoggerERROR.Printf("%s", err)
RequireAuth(rw, req, la.config, err)
return
return
}

defer conn.Close()
Expand Down Expand Up @@ -269,7 +269,7 @@ func LdapCheckUserAuthorized(conn *ldap.Conn, config *Config, entry *ldap.Entry,
}

// Check if user is allowed through groups
isValidGroups, err := LdapCheckUserGroups(conn, config, entry, username)
isValidGroups, err := LdapCheckUserGroups(conn, config, entry, username)
if isValidGroups {
return true, err
}
Expand Down Expand Up @@ -352,7 +352,7 @@ func LdapCheckUserGroups(conn *ldap.Conn, config *Config, entry *ldap.Entry, use
break
}

LoggerDEBUG.Printf("User '%s' not in any of the allowed groups", username)
LoggerDEBUG.Printf("User: '%s' not found in Group: '%s'", username, g)
}

return found, err
Expand Down

0 comments on commit 09175bf

Please sign in to comment.