public class

PreAuthenticatedAuthenticationProvider

extends Object
implements InitializingBean Ordered AuthenticationProvider
java.lang.Object
   ↳ org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationProvider

Class Overview

Processes a pre-authenticated authentication request. The request will typically originate from a AbstractPreAuthenticatedProcessingFilter subclass.

This authentication provider will not perform any checks on authentication requests, as they should already be pre-authenticated. However, the AuthenticationUserDetailsService implementation may still throw a UsernameNotFoundException, for example.

Summary

Public Constructors
PreAuthenticatedAuthenticationProvider()
Public Methods
void afterPropertiesSet()
Check whether all required properties have been set.
Authentication authenticate(Authentication authentication)
Authenticate the given PreAuthenticatedAuthenticationToken.
int getOrder()
void setOrder(int i)
void setPreAuthenticatedUserDetailsService(AuthenticationUserDetailsService<PreAuthenticatedAuthenticationToken> uds)
Set the AuthenticatedUserDetailsService to be used to load the UserDetails for the authenticated user.
void setThrowExceptionWhenTokenRejected(boolean throwExceptionWhenTokenRejected)
If true, causes the provider to throw a BadCredentialsException if the presented authentication request is invalid (contains a null principal or credentials).
void setUserDetailsChecker(UserDetailsChecker userDetailsChecker)
Sets the strategy which will be used to validate the loaded UserDetails object for the user.
final boolean supports(Class<?> authentication)
Indicate that this provider only supports PreAuthenticatedAuthenticationToken (sub)classes.
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.springframework.beans.factory.InitializingBean
From interface org.springframework.core.Ordered
From interface org.springframework.security.authentication.AuthenticationProvider

Public Constructors

public PreAuthenticatedAuthenticationProvider ()

Public Methods

public void afterPropertiesSet ()

Check whether all required properties have been set.

public Authentication authenticate (Authentication authentication)

Authenticate the given PreAuthenticatedAuthenticationToken.

If the principal contained in the authentication object is null, the request will be ignored to allow other providers to authenticate it.

Parameters
authentication the authentication request object.
Returns
  • 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.

public int getOrder ()

public void setOrder (int i)

public void setPreAuthenticatedUserDetailsService (AuthenticationUserDetailsService<PreAuthenticatedAuthenticationToken> uds)

Set the AuthenticatedUserDetailsService to be used to load the UserDetails for the authenticated user.

public void setThrowExceptionWhenTokenRejected (boolean throwExceptionWhenTokenRejected)

If true, causes the provider to throw a BadCredentialsException if the presented authentication request is invalid (contains a null principal or credentials). Otherwise it will just return null. Defaults to false.

public void setUserDetailsChecker (UserDetailsChecker userDetailsChecker)

Sets the strategy which will be used to validate the loaded UserDetails object for the user. Defaults to an AccountStatusUserDetailsChecker.

public final boolean supports (Class<?> authentication)

Indicate that this provider only supports PreAuthenticatedAuthenticationToken (sub)classes.

Returns
  • true if the implementation can more closely evaluate the Authentication class presented