Bug #1333: Allow specify * in role matching
This will be a wildcard to refer to all users or groups in the LDAP role matching configuration. FEA: ItEr76S04BugFixing
This commit is contained in:
parent
ed294fa214
commit
28a93c17b4
1 changed files with 16 additions and 0 deletions
|
|
@ -97,6 +97,12 @@ public class LDAPCustomAuthenticationProvider extends
|
|||
private static final Log LOG = LogFactory
|
||||
.getLog(LDAPCustomAuthenticationProvider.class);
|
||||
|
||||
/**
|
||||
* LDAP role matching could be configured using an asterix (*) to specify
|
||||
* all users or groups
|
||||
*/
|
||||
private static final String WILDCHAR_ALL = "*";
|
||||
|
||||
@Override
|
||||
protected void additionalAuthenticationChecks(UserDetails arg0,
|
||||
UsernamePasswordAuthenticationToken arg1)
|
||||
|
|
@ -287,6 +293,11 @@ public class LDAPCustomAuthenticationProvider extends
|
|||
|
||||
List<String> rolesReturn = new ArrayList<String>();
|
||||
for (ConfigurationRolesLDAP roleLDAP : rolesLdap) {
|
||||
if (roleLDAP.getRoleLdap().equals(WILDCHAR_ALL)) {
|
||||
rolesReturn.add(roleLDAP.getRoleLibreplan());
|
||||
continue;
|
||||
}
|
||||
|
||||
// We must make a search for each role-matching in nodes
|
||||
List<Attribute> resultsSearch = new ArrayList<Attribute>();
|
||||
resultsSearch.addAll(ldapTemplate.search(
|
||||
|
|
@ -317,6 +328,11 @@ public class LDAPCustomAuthenticationProvider extends
|
|||
|
||||
List<String> rolesReturn = new ArrayList<String>();
|
||||
for (ConfigurationRolesLDAP roleLdap : rolesLdap) {
|
||||
if (roleLdap.getRoleLdap().equals(WILDCHAR_ALL)) {
|
||||
rolesReturn.add(roleLdap.getRoleLibreplan());
|
||||
continue;
|
||||
}
|
||||
|
||||
// We must make a search for each role matching
|
||||
DirContextAdapter adapter = null;
|
||||
try {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue