Class PreAuthenticatedAuthenticationProvider
- java.lang.Object
-
- org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationProvider
-
- All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean,org.springframework.core.Ordered,org.springframework.security.authentication.AuthenticationProvider
public class PreAuthenticatedAuthenticationProvider extends java.lang.Object implements org.springframework.security.authentication.AuthenticationProvider, org.springframework.beans.factory.InitializingBean, org.springframework.core.OrderedProcesses a pre-authenticated authentication request. The request will typically originate from a
AbstractPreAuthenticatedProcessingFiltersubclass.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.
- Since:
- 2.0
-
-
Constructor Summary
Constructors Constructor Description PreAuthenticatedAuthenticationProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesSet()Check whether all required properties have been set.org.springframework.security.core.Authenticationauthenticate(org.springframework.security.core.Authentication authentication)Authenticate the given PreAuthenticatedAuthenticationToken.intgetOrder()voidsetOrder(int i)voidsetPreAuthenticatedUserDetailsService(org.springframework.security.core.userdetails.AuthenticationUserDetailsService<PreAuthenticatedAuthenticationToken> uds)Set the AuthenticatedUserDetailsService to be used to load theUserDetailsfor the authenticated user.voidsetThrowExceptionWhenTokenRejected(boolean throwExceptionWhenTokenRejected)If true, causes the provider to throw a BadCredentialsException if the presented authentication request is invalid (contains a null principal or credentials).voidsetUserDetailsChecker(org.springframework.security.core.userdetails.UserDetailsChecker userDetailsChecker)Sets the strategy which will be used to validate the loaded UserDetails object for the user.booleansupports(java.lang.Class<?> authentication)Indicate that this provider only supports PreAuthenticatedAuthenticationToken (sub)classes.
-
-
-
Method Detail
-
afterPropertiesSet
public void afterPropertiesSet()
Check whether all required properties have been set.- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
authenticate
public org.springframework.security.core.Authentication authenticate(org.springframework.security.core.Authentication authentication) throws org.springframework.security.core.AuthenticationExceptionAuthenticate 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.
- Specified by:
authenticatein interfaceorg.springframework.security.authentication.AuthenticationProvider- Throws:
org.springframework.security.core.AuthenticationException
-
supports
public final boolean supports(java.lang.Class<?> authentication)
Indicate that this provider only supports PreAuthenticatedAuthenticationToken (sub)classes.- Specified by:
supportsin interfaceorg.springframework.security.authentication.AuthenticationProvider
-
setPreAuthenticatedUserDetailsService
public void setPreAuthenticatedUserDetailsService(org.springframework.security.core.userdetails.AuthenticationUserDetailsService<PreAuthenticatedAuthenticationToken> uds)
Set the AuthenticatedUserDetailsService to be used to load theUserDetailsfor the authenticated user.- Parameters:
uds-
-
setThrowExceptionWhenTokenRejected
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.
-
setUserDetailsChecker
public void setUserDetailsChecker(org.springframework.security.core.userdetails.UserDetailsChecker userDetailsChecker)
Sets the strategy which will be used to validate the loaded UserDetails object for the user. Defaults to anAccountStatusUserDetailsChecker.- Parameters:
userDetailsChecker-
-
getOrder
public int getOrder()
- Specified by:
getOrderin interfaceorg.springframework.core.Ordered
-
setOrder
public void setOrder(int i)
-
-