SEC-1317: Removed check in ProviderManager.getProviders() for empty provider list. A ProviderManager with a non-null parent may have an empty provider list. The afterPropertiesSet() method performs the necessary checks.

This commit is contained in:
Luke Taylor 2009-12-07 21:38:40 +00:00
parent 444d93b13f
commit 02a9db7bcf
2 changed files with 2 additions and 11 deletions

View File

@ -178,10 +178,6 @@ public class ProviderManager extends AbstractAuthenticationManager implements Me
}
public List<AuthenticationProvider> getProviders() {
if (providers == null || providers.size() == 0) {
throw new IllegalArgumentException("A list of AuthenticationProviders is required");
}
return providers;
}
@ -194,6 +190,7 @@ public class ProviderManager extends AbstractAuthenticationManager implements Me
}
public void setAuthenticationEventPublisher(AuthenticationEventPublisher eventPublisher) {
Assert.notNull(eventPublisher, "AuthenticationEventPublisher cannot be null");
this.eventPublisher = eventPublisher;
}
@ -207,7 +204,7 @@ public class ProviderManager extends AbstractAuthenticationManager implements Me
*/
@SuppressWarnings("unchecked")
public void setProviders(List providers) {
Assert.notNull(providers);
Assert.notNull(providers, "Providers list cannot be null");
for(Object currentObject : providers) {
Assert.isInstanceOf(AuthenticationProvider.class, currentObject, "Can only provide AuthenticationProvider instances");
}

View File

@ -85,12 +85,6 @@ public class ProviderManagerTests {
mgr.setProviders(providers);
}
@Test(expected=IllegalArgumentException.class)
public void getProvidersFailsIfProviderListNotSet() throws Exception {
ProviderManager mgr = new ProviderManager();
mgr.getProviders();
}
@Test(expected=IllegalArgumentException.class)
public void testStartupFailsIfProvidersNotSet() throws Exception {
ProviderManager mgr = new ProviderManager();