mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-06-28 23:02:15 +00:00
SEC-393: More elegantly deal with setProviders(List) type safety enforcement.
This commit is contained in:
parent
5e819af782
commit
2984913051
@ -273,17 +273,8 @@ public class ProviderManager extends AbstractAuthenticationManager implements In
|
|||||||
Iterator iter = newList.iterator();
|
Iterator iter = newList.iterator();
|
||||||
|
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
Object currentObject = null;
|
Object currentObject = iter.next();
|
||||||
|
Assert.isInstanceOf(AuthenticationProvider.class, currentObject, "Can only provide AuthenticationProvider instances");
|
||||||
try {
|
|
||||||
currentObject = iter.next();
|
|
||||||
|
|
||||||
//TODO bad idea, should use assignable from or instance of
|
|
||||||
AuthenticationProvider attemptToCast = (AuthenticationProvider) currentObject;
|
|
||||||
} catch (ClassCastException cce) {
|
|
||||||
throw new IllegalArgumentException("AuthenticationProvider " + currentObject.getClass().getName()
|
|
||||||
+ " must implement AuthenticationProvider");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.providers = newList;
|
this.providers = newList;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user