org.acegisecurity.AbstractAuthenticationManager Maven / Gradle / Ivy
/* Copyright 2004 Acegi Technology Pty Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.acegisecurity;
/**
* An abstract implementation of the {@link AuthenticationManager}.
*
* @author Wesley Hall
* @version $Id: AbstractAuthenticationManager.java,v 1.2 2005/11/17 00:55:49 benalex Exp $
*/
public abstract class AbstractAuthenticationManager
implements AuthenticationManager {
//~ 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.
*
*
* @param authentication the authentication request object
*
* @return a fully authenticated object including credentials
*
* @throws AuthenticationException if authentication fails
*/
public final Authentication authenticate(Authentication authentication)
throws AuthenticationException {
try {
return doAuthentication(authentication);
} catch (AuthenticationException e) {
e.setAuthentication(authentication);
throw e;
}
}
/**
*
* Concrete implementations of this class override this method to provide
* the authentication service.
*
*
*
* The contract for this method is documented in the {@link
* AuthenticationManager#authenticate(org.acegisecurity.Authentication)}.
*
*
* @param authentication the authentication request object
*
* @return a fully authenticated object including credentials
*
* @throws AuthenticationException if authentication fails
*/
protected abstract Authentication doAuthentication(
Authentication authentication) throws AuthenticationException;
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy