Refactored DefaultLdapAuthoritiesPopulator to remove contextSource field and setter method.
This commit is contained in:
parent
1cfd886517
commit
7f28a8bc5d
|
@ -99,8 +99,6 @@ public class DefaultLdapAuthoritiesPopulator implements LdapAuthoritiesPopulator
|
||||||
*/
|
*/
|
||||||
private GrantedAuthority defaultRole;
|
private GrantedAuthority defaultRole;
|
||||||
|
|
||||||
private ContextSource contextSource;
|
|
||||||
|
|
||||||
private SpringSecurityLdapTemplate ldapTemplate;
|
private SpringSecurityLdapTemplate ldapTemplate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -143,8 +141,10 @@ public class DefaultLdapAuthoritiesPopulator implements LdapAuthoritiesPopulator
|
||||||
* context factory.
|
* context factory.
|
||||||
*/
|
*/
|
||||||
public DefaultLdapAuthoritiesPopulator(ContextSource contextSource, String groupSearchBase) {
|
public DefaultLdapAuthoritiesPopulator(ContextSource contextSource, String groupSearchBase) {
|
||||||
this.setContextSource(contextSource);
|
Assert.notNull(contextSource, "contextSource must not be null");
|
||||||
this.setGroupSearchBase(groupSearchBase);
|
ldapTemplate = new SpringSecurityLdapTemplate(contextSource);
|
||||||
|
ldapTemplate.setSearchControls(searchControls);
|
||||||
|
setGroupSearchBase(groupSearchBase);
|
||||||
}
|
}
|
||||||
|
|
||||||
//~ Methods ========================================================================================================
|
//~ Methods ========================================================================================================
|
||||||
|
@ -226,20 +226,7 @@ public class DefaultLdapAuthoritiesPopulator implements LdapAuthoritiesPopulator
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ContextSource getContextSource() {
|
protected ContextSource getContextSource() {
|
||||||
return contextSource;
|
return ldapTemplate.getContextSource();
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the {@link ContextSource}
|
|
||||||
*
|
|
||||||
* @param contextSource supplies the contexts used to search for user roles.
|
|
||||||
*/
|
|
||||||
private void setContextSource(ContextSource contextSource) {
|
|
||||||
Assert.notNull(contextSource, "contextSource must not be null");
|
|
||||||
this.contextSource = contextSource;
|
|
||||||
|
|
||||||
ldapTemplate = new SpringSecurityLdapTemplate(contextSource);
|
|
||||||
ldapTemplate.setSearchControls(searchControls);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue