mirror of
https://github.com/minio/minio.git
synced 2025-01-25 21:53:16 -05:00
LDAP config: fix substitution variables (#11586)
- In username search filter and username format variables we support %s for replacing with the username. - In group search filter we support %s for username and %d for the full DN of the username.
This commit is contained in:
parent
cec12f4c76
commit
02e7de6367
@ -301,7 +301,8 @@ func (l *Config) Bind(username, password string) (string, []string, error) {
|
|||||||
var groups []string
|
var groups []string
|
||||||
if l.GroupSearchFilter != "" {
|
if l.GroupSearchFilter != "" {
|
||||||
for _, groupSearchBase := range l.GroupSearchBaseDistNames {
|
for _, groupSearchBase := range l.GroupSearchBaseDistNames {
|
||||||
filter := strings.Replace(l.GroupSearchFilter, "%s", ldap.EscapeFilter(bindDN), -1)
|
filter := strings.Replace(l.GroupSearchFilter, "%s", ldap.EscapeFilter(username), -1)
|
||||||
|
filter = strings.Replace(filter, "%d", ldap.EscapeFilter(bindDN), -1)
|
||||||
searchRequest := ldap.NewSearchRequest(
|
searchRequest := ldap.NewSearchRequest(
|
||||||
groupSearchBase,
|
groupSearchBase,
|
||||||
ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false,
|
ldap.ScopeWholeSubtree, ldap.NeverDerefAliases, 0, 0, false,
|
||||||
|
@ -123,7 +123,13 @@ export MINIO_IDENTITY_LDAP_TLS_SKIP_VERIFY=on
|
|||||||
|
|
||||||
### Variable substitution in AD/LDAP configuration strings ###
|
### Variable substitution in AD/LDAP configuration strings ###
|
||||||
|
|
||||||
`%s` is replaced with *username* automatically for construction bind_dn, search_filter and group_search_filter.
|
In the configuration variables, `%s` is substituted with the *username* from the STS request and `%d` is substituted with the *distinguished username (user DN)* of the LDAP user. Please see the following table for which configuration variables support these substitution variables:
|
||||||
|
|
||||||
|
| Variable | Supported substitutions |
|
||||||
|
|---------------------------------------------|-------------------------|
|
||||||
|
| `MINIO_IDENTITY_LDAP_USERNAME_FORMAT` | `%s` |
|
||||||
|
| `MINIO_IDENTITY_LDAP_USER_DN_SEARCH_FILTER` | `%s` |
|
||||||
|
| `MINIO_IDENTITY_LDAP_GROUP_SEARCH_FILTER` | `%s` and `%d` |
|
||||||
|
|
||||||
## Managing User/Group Access Policy
|
## Managing User/Group Access Policy
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user