Class EmbeddedLoginTokenAuthenticationProvider
- java.lang.Object
-
- com.broadleafcommerce.auth.user.session.embedded.EmbeddedLoginTokenAuthenticationProvider
-
- All Implemented Interfaces:
org.springframework.security.authentication.AuthenticationProvider
public class EmbeddedLoginTokenAuthenticationProvider extends Object implements org.springframework.security.authentication.AuthenticationProvider
Authenticates the user for theTokenEndpointbased on a one-time passcode parameter.- Author:
- Cade Rea (cade-rea)
-
-
Constructor Summary
Constructors Constructor Description EmbeddedLoginTokenAuthenticationProvider(OAuth2UserDetailsService userDetailsService, PasscodeService<PasswordToken,User> passcodeService, UserService<User> userService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.springframework.security.core.Authenticationauthenticate(org.springframework.security.core.Authentication authentication)protected EmbeddedLoginTokenEndpointAuthenticationTokenbuildEmbeddedLoginTokenEndpointAuthenticationToken(OAuth2UserDetails userDetails, String clientId, String username, String scope, String code, String purpose)protected org.springframework.security.oauth2.provider.OAuth2RequestbuildOAuth2Request(String clientId, OAuth2UserDetails userDetails, String scope)Build a syntheticOAuth2Request.protected PasscodeService<PasswordToken,User>getPasscodeService()protected OAuth2UserDetailsServicegetUserDetailsService()protected UserService<User>getUserService()booleansupports(Class<?> authentication)
-
-
-
Constructor Detail
-
EmbeddedLoginTokenAuthenticationProvider
public EmbeddedLoginTokenAuthenticationProvider(OAuth2UserDetailsService userDetailsService, PasscodeService<PasswordToken,User> passcodeService, UserService<User> userService)
-
-
Method Detail
-
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
-
buildEmbeddedLoginTokenEndpointAuthenticationToken
protected EmbeddedLoginTokenEndpointAuthenticationToken buildEmbeddedLoginTokenEndpointAuthenticationToken(OAuth2UserDetails userDetails, String clientId, String username, String scope, String code, String purpose)
- Parameters:
userDetails- TheUserDetailsfor the authenticated User.clientId- The client_id from the request.username- The username of the authenticated User.scope- The requested scopes.code- The one-time passcode used for authentication.purpose- The purpose of the one-time passcode used for authentication.- Returns:
- An authenticated
EmbeddedLoginTokenEndpointAuthenticationToken.
-
buildOAuth2Request
protected org.springframework.security.oauth2.provider.OAuth2Request buildOAuth2Request(String clientId, OAuth2UserDetails userDetails, String scope)
Build a syntheticOAuth2Request. This is needed to issue tokens from theTokenEndpoint.- Parameters:
clientId- The client_id from the request.userDetails- TheUserDetailsfor the authenticated User.scope- The requested scopes.- Returns:
- An approved
OAuth2Request.
-
supports
public boolean supports(Class<?> authentication)
- Specified by:
supportsin interfaceorg.springframework.security.authentication.AuthenticationProvider
-
getPasscodeService
protected PasscodeService<PasswordToken,User> getPasscodeService()
-
getUserDetailsService
protected OAuth2UserDetailsService getUserDetailsService()
-
getUserService
protected UserService<User> getUserService()
-
-