Skip to content

Commit

Permalink
make the method to get group name from DN more generic
Browse files Browse the repository at this point in the history
Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
  • Loading branch information
drakkan committed Aug 21, 2024
1 parent bbb7149 commit ab1abb6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions authenticator/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,11 @@ func getCNFromDN(dn string) string {
parts := strings.Split(dn, ",")
if len(parts) > 0 {
cn := strings.ToLower(parts[0])
if strings.HasPrefix(cn, "cn=") || strings.HasPrefix(cn, "ou=") {
return strings.TrimSpace(cn[3:])
subParts := strings.Split(cn, "=")
if len(subParts) == 2 {
return strings.TrimSpace(subParts[1])
}
// See #13.
return cn
}
return ""
Expand Down

0 comments on commit ab1abb6

Please sign in to comment.