diff --git a/core/src/main/java/org/springframework/security/AbstractAuthenticationManager.java b/core/src/main/java/org/springframework/security/AbstractAuthenticationManager.java index c556e57d57..5a6164e267 100644 --- a/core/src/main/java/org/springframework/security/AbstractAuthenticationManager.java +++ b/core/src/main/java/org/springframework/security/AbstractAuthenticationManager.java @@ -28,10 +28,11 @@ public abstract class AbstractAuthenticationManager implements AuthenticationMan //~ Methods ======================================================================================================== /** - *
An implementation of the authenticate method that calls the abstract method
- * doAuthenticatation to do its work.
If doAuthenticate throws an AuthenticationException then the exception is populated
- * with the failed Authentication object that failed.
authenticate method that calls the abstract method
+ * doAuthenticatation to do its work.
+ *
+ * If doAuthenticate throws an AuthenticationException then the exception is populated
+ * with the failed Authentication object that failed.
*
* @param authRequest the authentication request object
*
diff --git a/core/src/main/java/org/springframework/security/providers/ProviderManager.java b/core/src/main/java/org/springframework/security/providers/ProviderManager.java
index 6a5be02f52..77706a4199 100644
--- a/core/src/main/java/org/springframework/security/providers/ProviderManager.java
+++ b/core/src/main/java/org/springframework/security/providers/ProviderManager.java
@@ -82,18 +82,23 @@ import java.util.Properties;
* provides a non-null response, or a new AuthenticationException, the last
* AuthenticationException received will be used. If no provider returns a non-null response, or indicates
* it can even process an Authentication, the ProviderManager will throw a
- * ProviderNotFoundException.
ProviderNotFoundException.
*
- * If a valid Authentication is returned by an AuthenticationProvider, the
- * ProviderManager will publish an {@link
- * org.springframework.security.event.authentication.AuthenticationSuccessEvent}. If an AuthenticationException is
- * detected, the final AuthenticationException thrown will be used to publish an appropriate failure
- * event. By default ProviderManager maps common exceptions to events, but this can be fine-tuned by
- * providing a new exceptionMappingsjava.util.Properties object. In the properties object,
- * each of the keys represent the fully qualified classname of the exception, and each of the values represent the
- * name of an event class which subclasses {@link
- * org.springframework.security.event.authentication.AbstractAuthenticationFailureEvent} and provides its constructor.
+ * If a valid Authentication is returned by an AuthenticationProvider, the
+ * ProviderManager will publish an
+ * {@link org.springframework.security.event.authentication.AuthenticationSuccessEvent}. If an
+ * AuthenticationException is detected, the final AuthenticationException thrown will be
+ * used to publish an appropriate failure event. By default ProviderManager maps common exceptions to
+ * events, but this can be fine-tuned by providing a new exceptionMappingsjava.util.Properties
+ * object. In the properties object, each of the keys represent the fully qualified classname of the exception, and
+ * each of the values represent the name of an event class which subclasses
+ * {@link org.springframework.security.event.authentication.AbstractAuthenticationFailureEvent}
+ * and provides its constructor.
*
+ *
+ * @author Ben Alex
+ * @version $Id$
* @see ConcurrentSessionController
*/
public class ProviderManager extends AbstractAuthenticationManager implements InitializingBean,
@@ -161,13 +166,16 @@ public class ProviderManager extends AbstractAuthenticationManager implements In
protected void doAddExtraDefaultExceptionMappings(Properties exceptionMappings) {}
/**
- * Attempts to authenticate the passed {@link Authentication} object.
The list of {@link
- * AuthenticationProvider}s will be successively tried until an AuthenticationProvider indicates it
- * is capable of authenticating the type of Authentication object passed. Authentication will then
- * be attempted with that AuthenticationProvider.
If more than one AuthenticationProvider supports the passed Authentication
+ * Attempts to authenticate the passed {@link Authentication} object.
+ *
+ * The list of {@link AuthenticationProvider}s will be successively tried until an
+ * AuthenticationProvider indicates it is capable of authenticating the type of
+ * Authentication object passed. Authentication will then be attempted with that
+ * AuthenticationProvider.
+ *
+ * If more than one AuthenticationProvider supports the passed Authentication
* object, only the first AuthenticationProvider tried will determine the result. No subsequent
- * AuthenticationProviders will be tried.
AuthenticationProviders will be tried.
*
* @param authentication the authentication request object.
*
@@ -175,8 +183,7 @@ public class ProviderManager extends AbstractAuthenticationManager implements In
*
* @throws AuthenticationException if authentication fails.
*/
- public Authentication doAuthentication(Authentication authentication)
- throws AuthenticationException {
+ public Authentication doAuthentication(Authentication authentication) throws AuthenticationException {
Iterator iter = providers.iterator();
Class toTest = authentication.getClass();
@@ -189,7 +196,7 @@ public class ProviderManager extends AbstractAuthenticationManager implements In
if (provider.supports(toTest)) {
logger.debug("Authentication attempt using " + provider.getClass().getName());
- Authentication result = null;
+ Authentication result;
try {
result = provider.authenticate(authentication);
@@ -270,14 +277,15 @@ public class ProviderManager extends AbstractAuthenticationManager implements In
/**
* Sets the {@link AuthenticationProvider} objects to be used for authentication.
*
- * @param newList
+ * @param providers the list of authentication providers which will be used to process authentication requests.
*
- * @throws IllegalArgumentException DOCUMENT ME!
+ * @throws IllegalArgumentException if the list is empty or null, or any of the elements in the list is not an
+ * AuthenticationProvider instance.
*/
- public void setProviders(List newList) {
- checkIfValidList(newList);
+ public void setProviders(List providers) {
+ checkIfValidList(providers);
- Iterator iter = newList.iterator();
+ Iterator iter = providers.iterator();
while (iter.hasNext()) {
Object currentObject = iter.next();
@@ -285,12 +293,12 @@ public class ProviderManager extends AbstractAuthenticationManager implements In
"Can only provide AuthenticationProvider instances");
}
- this.providers = newList;
+ this.providers = providers;
}
/**
- * Set the {@link ConcurrentSessionController} to be used for limiting user's sessions. The {@link
- * NullConcurrentSessionController} is used by default
+ * Set the {@link ConcurrentSessionController} to be used for limiting users' sessions. The {@link
+ * NullConcurrentSessionController} is used by default.
*
* @param sessionController {@link ConcurrentSessionController}
*/