Class CoreAuthenticationProvider
- java.lang.Object
-
- de.hybris.platform.spring.security.CoreAuthenticationProvider
-
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.beans.factory.InitializingBean,org.springframework.context.MessageSourceAware,org.springframework.security.authentication.AuthenticationProvider
- Direct Known Subclasses:
AbstractAcceleratorAuthenticationProvider,BackofficeAuthenticationProvider,CockpitAuthenticationProvider,PunchOutCoreAuthenticationProvider
public class CoreAuthenticationProvider extends java.lang.Object implements org.springframework.security.authentication.AuthenticationProvider, org.springframework.beans.factory.InitializingBean, org.springframework.context.MessageSourceAwareA baseAuthenticationProviderwhich is designed to respond toUsernamePasswordAuthenticationTokenandRememberMeAuthenticationTokenauthentication requests.Upon successful validation, a
UsernamePasswordAuthenticationTokenorRememberMeAuthenticationTokenwill be created and returned to the caller. The token will include as its principal either aStringrepresentation of the username, or theCoreUserDetailsthat was returned from the authentication repository. UsingStringis appropriate if a container adapter is being used, as it expectsStringrepresentations of the username. UsingCoreUserDetailsis appropriate if you require access to additional properties of the authenticated user, such as email addresses, human-friendly names etc. As container adapters are not recommended to be used, andCoreUserDetailsimplementations provide additional flexibility, by default aCoreUserDetailsis returned.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCoreAuthenticationProvider.CoreAuthenticationException
-
Field Summary
Fields Modifier and Type Field Description protected org.springframework.context.support.MessageSourceAccessormessages
-
Constructor Summary
Constructors Constructor Description CoreAuthenticationProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidadditionalAuthenticationChecks(org.springframework.security.core.userdetails.UserDetails details, org.springframework.security.authentication.AbstractAuthenticationToken authentication)voidafterPropertiesSet()org.springframework.security.core.Authenticationauthenticate(org.springframework.security.core.Authentication authentication)protected org.springframework.security.core.AuthenticationcreateSuccessAuthentication(org.springframework.security.core.Authentication authentication, org.springframework.security.core.userdetails.UserDetails user)Creates a successfulAuthenticationobject.org.springframework.security.core.userdetails.UserDetailsCheckergetPreAuthenticationChecks()org.springframework.security.core.userdetails.UserDetailsServicegetUserDetailsService()protected org.springframework.security.core.userdetails.UserDetailsretrieveUser(java.lang.String username)voidsetMessageSource(org.springframework.context.MessageSource messageSource)voidsetPreAuthenticationChecks(org.springframework.security.core.userdetails.UserDetailsChecker preAuthenticationChecks)voidsetUserDetailsService(org.springframework.security.core.userdetails.UserDetailsService userDetailsService)booleansupports(java.lang.Class authentication)
-
-
-
Method Detail
-
setMessageSource
public void setMessageSource(org.springframework.context.MessageSource messageSource)
- Specified by:
setMessageSourcein interfaceorg.springframework.context.MessageSourceAware
-
afterPropertiesSet
public final void afterPropertiesSet() throws java.lang.Exception- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
java.lang.Exception
-
setPreAuthenticationChecks
public void setPreAuthenticationChecks(org.springframework.security.core.userdetails.UserDetailsChecker preAuthenticationChecks)
-
getPreAuthenticationChecks
public org.springframework.security.core.userdetails.UserDetailsChecker getPreAuthenticationChecks()
-
authenticate
public org.springframework.security.core.Authentication authenticate(org.springframework.security.core.Authentication authentication) throws org.springframework.security.core.AuthenticationException- Specified by:
authenticatein interfaceorg.springframework.security.authentication.AuthenticationProvider- Throws:
org.springframework.security.core.AuthenticationException
-
getUserDetailsService
public org.springframework.security.core.userdetails.UserDetailsService getUserDetailsService()
-
setUserDetailsService
public void setUserDetailsService(org.springframework.security.core.userdetails.UserDetailsService userDetailsService)
-
additionalAuthenticationChecks
protected void additionalAuthenticationChecks(org.springframework.security.core.userdetails.UserDetails details, org.springframework.security.authentication.AbstractAuthenticationToken authentication) throws org.springframework.security.core.AuthenticationException- Throws:
org.springframework.security.core.AuthenticationException
-
supports
public boolean supports(java.lang.Class authentication)
- Specified by:
supportsin interfaceorg.springframework.security.authentication.AuthenticationProvider
-
retrieveUser
protected final org.springframework.security.core.userdetails.UserDetails retrieveUser(java.lang.String username) throws org.springframework.security.core.AuthenticationException- Throws:
org.springframework.security.core.AuthenticationException
-
createSuccessAuthentication
protected org.springframework.security.core.Authentication createSuccessAuthentication(org.springframework.security.core.Authentication authentication, org.springframework.security.core.userdetails.UserDetails user)Creates a successfulAuthenticationobject.Protected so subclasses can override.
Subclasses will usually store the original credentials the user supplied (not salted or encoded passwords) in the returned
Authenticationobject.- Parameters:
authentication- that was presented to the provider for validationuser- that was loaded by the implementation- Returns:
- the successful authentication token
-
-