Allowing filtering of LDAP groups

This commit is contained in:
Mat Jaggard 2015-10-23 11:01:44 +01:00
parent 7142138dcc
commit e546fe3bc0
2 changed files with 11 additions and 0 deletions

View File

@ -92,6 +92,8 @@ public class DefaultLdapRoleMapper
private String groupsDn;
private String groupFilter;
private String baseDn;
private String ldapGroupMember = "uniquemember";
@ -120,6 +122,8 @@ public class DefaultLdapRoleMapper
this.groupsDn = this.baseDn;
}
this.groupFilter = userConf.getString( UserConfigurationKeys.LDAP_GROUPS_FILTER, this.groupFilter );
this.useDefaultRoleName =
userConf.getBoolean( UserConfigurationKeys.LDAP_GROUPS_USE_ROLENAME, this.useDefaultRoleName );
@ -145,6 +149,11 @@ public class DefaultLdapRoleMapper
String filter = "objectClass=" + getLdapGroupClass();
if ( !StringUtils.isEmpty( this.groupFilter ) )
{
filter = "&(" + filter + ")(" + this.groupFilter + ")";
}
namingEnumeration = context.search( getGroupsDn(), filter, searchControls );
List<String> allGroups = new ArrayList<String>();

View File

@ -84,6 +84,8 @@ public interface UserConfigurationKeys
String LDAP_GROUPS_BASEDN = "ldap.config.groups.base.dn";
String LDAP_GROUPS_FILTER = "ldap.config.groups.filter";
String LDAP_GROUPS_MEMBER = "ldap.config.groups.member";
String LDAP_GROUPS_ROLE_START_KEY = "ldap.config.groups.role.";