mirror of
https://github.com/minio/minio.git
synced 2025-11-07 12:52:58 -05:00
Add DecodeDN and QuickNormalizeDN functions to LDAP config (#20076)
This commit is contained in:
@@ -402,3 +402,21 @@ func (l *Config) LookupGroupMemberships(userDistNames []string, userDNToUsername
|
||||
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// QuickNormalizeDN - normalizes the given DN without checking if it is valid or
|
||||
// exists in the LDAP directory. Returns input if error
|
||||
func (l Config) QuickNormalizeDN(dn string) string {
|
||||
if normDN, err := xldap.NormalizeDN(dn); err == nil {
|
||||
return normDN
|
||||
}
|
||||
return dn
|
||||
}
|
||||
|
||||
// DecodeDN - denormalizes the given DN by unescaping any escaped characters.
|
||||
// Returns input if error
|
||||
func (l Config) DecodeDN(dn string) string {
|
||||
if decodedDN, err := xldap.DecodeDN(dn); err == nil {
|
||||
return decodedDN
|
||||
}
|
||||
return dn
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user