diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/users/services/LDAPCustomAuthenticationProvider.java b/libreplan-webapp/src/main/java/org/libreplan/web/users/services/LDAPCustomAuthenticationProvider.java index 4fd7f4ac5..f30d5851f 100644 --- a/libreplan-webapp/src/main/java/org/libreplan/web/users/services/LDAPCustomAuthenticationProvider.java +++ b/libreplan-webapp/src/main/java/org/libreplan/web/users/services/LDAPCustomAuthenticationProvider.java @@ -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 rolesReturn = new ArrayList(); 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 resultsSearch = new ArrayList(); resultsSearch.addAll(ldapTemplate.search( @@ -317,6 +328,11 @@ public class LDAPCustomAuthenticationProvider extends List rolesReturn = new ArrayList(); 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 {