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

org.springframework.security.authentication.AuthenticationProvider Maven / Gradle / Ivy

There is a newer version: 6.2.4
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
 *
 *      https://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.springframework.security.authentication;

import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;

/**
 * Indicates a class can process a specific
 * {@link org.springframework.security.core.Authentication} implementation.
 *
 * @author Ben Alex
 */
public interface AuthenticationProvider {

	/**
	 * Performs authentication with the same contract as
	 * {@link org.springframework.security.authentication.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.
	 */
	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 * @return true if the implementation can more closely evaluate the * Authentication class presented */ boolean supports(Class authentication); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy