mirror of
https://github.com/minio/minio.git
synced 2025-11-07 21:02:58 -05:00
fix: LDAP groups handling and group mapping (#11855)
comprehensively handle group mapping for LDAP users across IAM sub-subsytem.
This commit is contained in:
@@ -498,20 +498,11 @@ func (sts *stsAPIHandlers) AssumeRoleWithLDAPIdentity(w http.ResponseWriter, r *
|
||||
}
|
||||
|
||||
// Check if this user or their groups have a policy applied.
|
||||
globalIAMSys.Lock()
|
||||
found := false
|
||||
if _, ok := globalIAMSys.iamUserPolicyMap[ldapUserDN]; ok {
|
||||
found = true
|
||||
}
|
||||
for _, groupDistName := range groupDistNames {
|
||||
if _, ok := globalIAMSys.iamGroupPolicyMap[groupDistName]; ok {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
globalIAMSys.Unlock()
|
||||
if !found {
|
||||
writeSTSErrorResponse(ctx, w, true, ErrSTSInvalidParameterValue, fmt.Errorf("expecting a policy to be set for user `%s` or one of their groups: `%s` - rejecting this request", ldapUserDN, strings.Join(groupDistNames, "`,`")))
|
||||
ldapPolicies, _ := globalIAMSys.PolicyDBGetLDAP(ldapUserDN, groupDistNames...)
|
||||
if len(ldapPolicies) == 0 {
|
||||
writeSTSErrorResponse(ctx, w, true, ErrSTSInvalidParameterValue,
|
||||
fmt.Errorf("expecting a policy to be set for user `%s` or one of their groups: `%s` - rejecting this request",
|
||||
ldapUserDN, strings.Join(groupDistNames, "`,`")))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user