diff --git a/auth_server/authn/ldap_auth.go b/auth_server/authn/ldap_auth.go index 02194fa4..cc837cd9 100644 --- a/auth_server/authn/ldap_auth.go +++ b/auth_server/authn/ldap_auth.go @@ -32,6 +32,7 @@ import ( type LabelMap struct { Attribute string `yaml:"attribute,omitempty"` ParseCN bool `yaml:"parse_cn,omitempty"` + LowerCase bool `yaml:"lower_case",omitempty"` } type LDAPAuthConfig struct { @@ -299,6 +300,11 @@ func (la *LDAPAuth) getLabelsFromMap(attrMap map[string][]string) (map[string][] mappingValues[i] = cn } } + if mapping.LowerCase { + for i, value := range mappingValues { + mappingValues[i] = strings.ToLower(value) + } + } labels[key] = mappingValues } } diff --git a/examples/reference.yml b/examples/reference.yml index 96b6b0a5..b720d8a5 100644 --- a/examples/reference.yml +++ b/examples/reference.yml @@ -260,6 +260,8 @@ ldap_auth: attribute: memberOf # Special handling to simplify the values to just the common name parse_cn: true + # lower case the value + lower_case: true mongo_auth: # Essentially all options are described here: https://godoc.org/gopkg.in/mgo.v2#DialInfo