1 package org
.argeo
.security
.ldap
;
3 import org
.springframework
.ldap
.core
.ContextSource
;
4 import org
.springframework
.security
.ldap
.populator
.DefaultLdapAuthoritiesPopulator
;
6 /** TODO: notify Spring Security to open this class more. */
7 public class ArgeoLdapAuthoritiesPopulator
extends
8 DefaultLdapAuthoritiesPopulator
{
10 /* Hacked from parent class */
11 private String groupRoleAttribute
= "cn";
12 private final String groupSearchBase
;
13 private String rolePrefix
= "ROLE_";
14 private boolean convertToUpperCase
= true;
16 public ArgeoLdapAuthoritiesPopulator(ContextSource contextSource
,
17 String groupSearchBase
) {
18 super(contextSource
, groupSearchBase
);
19 this.groupSearchBase
= groupSearchBase
;
23 public void setConvertToUpperCase(boolean convertToUpperCase
) {
24 super.setConvertToUpperCase(convertToUpperCase
);
25 this.convertToUpperCase
= convertToUpperCase
;
29 public void setGroupRoleAttribute(String groupRoleAttribute
) {
30 super.setGroupRoleAttribute(groupRoleAttribute
);
31 this.groupRoleAttribute
= groupRoleAttribute
;
35 public void setRolePrefix(String rolePrefix
) {
36 super.setRolePrefix(rolePrefix
);
37 this.rolePrefix
= rolePrefix
;
40 /** Hacked from parent class. */
41 public String
convertGroupToRole(String groupName
) {
42 if (convertToUpperCase
) {
43 groupName
= groupName
.toUpperCase();
46 return rolePrefix
+ groupName
;
49 public String
getGroupRoleAttribute() {
50 return groupRoleAttribute
;
53 public String
getGroupSearchBase() {
54 return groupSearchBase
;