All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.acegisecurity.providers.AuthenticationProvider Maven / Gradle / Ivy

There is a newer version: 1.0.7
Show newest version
/* Copyright 2004, 2005, 2006 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.providers;

import org.acegisecurity.Authentication;
import org.acegisecurity.AuthenticationException;


/**
 * Indicates a class can process a specific  {@link
 * org.acegisecurity.Authentication} implementation.
 *
 * @author Ben Alex
 * @version $Id: AuthenticationProvider.java 1496 2006-05-23 13:38:33Z benalex $
 */
public interface AuthenticationProvider {
    //~ Methods ========================================================================================================

    /**
     * Performs authentication with the same contract as {@link
     * org.acegisecurity.AuthenticationManager#authenticate(Authentication)}.
     *
     * @param authentication the authentication request object.
     *
     * @return a fully authenticated object including credentials. May return null if the
     *         AuthenticationProvider is unable to support authentication of the passed
     *         Authentication object. In such a case, the next AuthenticationProvider that
     *         supports the presented Authentication class will be tried.
     *
     * @throws AuthenticationException if authentication fails.
     */
    public Authentication authenticate(Authentication authentication)
        throws AuthenticationException;

    /**
     * Returns true if this AuthenticationProvider supports the indicated
     * Authentication object.

Returning true does not guarantee an * AuthenticationProvider will be able to authenticate the presented instance of the * Authentication class. It simply indicates it can support closer evaluation of it. An * AuthenticationProvider can still return null from the {@link * #authenticate(Authentication)} method to indicate another AuthenticationProvider should be tried.

*

Selection of an AuthenticationProvider capable of performing authentication is * conducted at runtime the ProviderManager.

* * @param authentication DOCUMENT ME! * * @return true if the implementation can more closely evaluate the Authentication class * presented */ public boolean supports(Class authentication); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy