DeferredCreationLdapAuthoritiesPopulator is no longer necessary because filters are now created after SecurityRealm is prepared.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@14872 71c3de6d-444a-0410-be80-ed276b4c234a

Originally-Committed-As: 3beed588ad53269bf8f32e49ff84eed8572093f5
This commit is contained in:
kohsuke 2009-01-29 17:29:26 +00:00
parent 4b0a39b206
commit bbcdae89b4
2 changed files with 5 additions and 13 deletions

View file

@ -176,7 +176,6 @@ public class LDAPSecurityRealm extends SecurityRealm {
BeanBuilder builder = new BeanBuilder();
builder.parse(Hudson.getInstance().servletContext.getResourceAsStream("/WEB-INF/security/LDAPBindSecurityRealm.groovy"),binding);
final WebApplicationContext appContext = builder.createApplicationContext();
correctAuthoritiesPopulator(appContext);
return new SecurityComponents(
findBean(AuthenticationManager.class, appContext),
@ -193,15 +192,6 @@ public class LDAPSecurityRealm extends SecurityRealm {
});
}
/**
* Adjust the authoritiesPopulator bean to have the correct groupSearchBase
* @param appContext
*/
private void correctAuthoritiesPopulator(WebApplicationContext appContext) {
DeferredCreationLdapAuthoritiesPopulator factory = (DeferredCreationLdapAuthoritiesPopulator) appContext.getBean("authoritiesPopulator");
factory.setGroupSearchBase(groupSearchBase==null ? "" : groupSearchBase);
}
/**
* If the security realm is LDAP, try to pick up e-mail address from LDAP.
*/

View file

@ -6,7 +6,8 @@ import org.acegisecurity.ldap.DefaultInitialDirContextFactory
import org.acegisecurity.ldap.search.FilterBasedLdapUserSearch
import org.acegisecurity.providers.rememberme.RememberMeAuthenticationProvider
import hudson.model.Hudson
import hudson.security.DeferredCreationLdapAuthoritiesPopulator
import org.acegisecurity.providers.ldap.populator.DefaultLdapAuthoritiesPopulator
import hudson.Util
/*
Configure LDAP as the authentication realm.
@ -35,8 +36,9 @@ bindAuthenticator(BindAuthenticator2,initialDirContextFactory) {
userSearch = ldapUserSearch;
}
authoritiesPopulator(DeferredCreationLdapAuthoritiesPopulator,initialDirContextFactory,"") {
// groupRoleAttribute = "ou";
authoritiesPopulator(DefaultLdapAuthoritiesPopulator, initialDirContextFactory, Util.fixNull(instance.groupSearchBase)) {
// see DefaultLdapAuthoritiesPopulator for other possible configurations
searchSubtree = true;
}
authenticationManager(ProviderManager) {