mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-06-27 06:12:27 +00:00
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:
parent
444d93b13f
commit
02a9db7bcf
@ -178,10 +178,6 @@ public class ProviderManager extends AbstractAuthenticationManager implements Me
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<AuthenticationProvider> getProviders() {
|
public List<AuthenticationProvider> getProviders() {
|
||||||
if (providers == null || providers.size() == 0) {
|
|
||||||
throw new IllegalArgumentException("A list of AuthenticationProviders is required");
|
|
||||||
}
|
|
||||||
|
|
||||||
return providers;
|
return providers;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,6 +190,7 @@ public class ProviderManager extends AbstractAuthenticationManager implements Me
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setAuthenticationEventPublisher(AuthenticationEventPublisher eventPublisher) {
|
public void setAuthenticationEventPublisher(AuthenticationEventPublisher eventPublisher) {
|
||||||
|
Assert.notNull(eventPublisher, "AuthenticationEventPublisher cannot be null");
|
||||||
this.eventPublisher = eventPublisher;
|
this.eventPublisher = eventPublisher;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,7 +204,7 @@ public class ProviderManager extends AbstractAuthenticationManager implements Me
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void setProviders(List providers) {
|
public void setProviders(List providers) {
|
||||||
Assert.notNull(providers);
|
Assert.notNull(providers, "Providers list cannot be null");
|
||||||
for(Object currentObject : providers) {
|
for(Object currentObject : providers) {
|
||||||
Assert.isInstanceOf(AuthenticationProvider.class, currentObject, "Can only provide AuthenticationProvider instances");
|
Assert.isInstanceOf(AuthenticationProvider.class, currentObject, "Can only provide AuthenticationProvider instances");
|
||||||
}
|
}
|
||||||
|
@ -85,12 +85,6 @@ public class ProviderManagerTests {
|
|||||||
mgr.setProviders(providers);
|
mgr.setProviders(providers);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected=IllegalArgumentException.class)
|
|
||||||
public void getProvidersFailsIfProviderListNotSet() throws Exception {
|
|
||||||
ProviderManager mgr = new ProviderManager();
|
|
||||||
mgr.getProviders();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test(expected=IllegalArgumentException.class)
|
@Test(expected=IllegalArgumentException.class)
|
||||||
public void testStartupFailsIfProvidersNotSet() throws Exception {
|
public void testStartupFailsIfProvidersNotSet() throws Exception {
|
||||||
ProviderManager mgr = new ProviderManager();
|
ProviderManager mgr = new ProviderManager();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user