Class ProviderLoginSupportImpl
java.lang.Object
org.craftercms.security.social.impl.ProviderLoginSupportImpl
- All Implemented Interfaces:
ProviderLoginSupport
Default implementation of
ProviderLoginSupport. On complete(String, String, HttpServletRequest), if the
user data of the provider connection corresponds to an existing Crafter Profile user, the profile connection data
will be updated. If a profile doesn't exist, a new one with the connection data will be created. In both cases, the
user is automatically authenticated with Crafter Profile.- Author:
- avasquez
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AuthenticationManagerprotected org.springframework.social.connect.ConnectionFactoryLocatorprotected org.springframework.social.connect.web.ConnectSupportstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected ProfileServiceprotected org.craftercms.commons.crypto.TextEncryptor -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCompletes the OAuth authentication, returning the resultingAuthenticationobject, or null if it couldn't be completed.complete(String tenant, String providerId, javax.servlet.http.HttpServletRequest request, Set<String> newUserRoles, Map<String, Object> newUserAttributes) Completes the OAuth authentication, returning the resultingAuthenticationobject, or null if it couldn't be completed.complete(String tenant, String providerId, javax.servlet.http.HttpServletRequest request, Set<String> newUserRoles, Map<String, Object> newUserAttributes, org.springframework.social.connect.web.ConnectSupport connectSupport) Completes the OAuth authentication, returning the resultingAuthenticationobject, or null if it couldn't be completed.protected org.springframework.social.connect.Connection<?>completeConnection(org.springframework.social.connect.web.ConnectSupport connectSupport, String providerId, javax.servlet.http.HttpServletRequest request) protected ProfilecreateProfile(String tenant, org.springframework.social.connect.Connection<?> connection, Profile userData) protected org.springframework.social.connect.ConnectionFactory<?>getConnectionFactory(String providerId) protected ProfilegetProfile(String tenant, Profile userData) voidsetAuthenticationManager(AuthenticationManager authenticationManager) voidsetConnectionFactoryLocator(org.springframework.social.connect.ConnectionFactoryLocator connectionFactoryLocator) voidsetConnectSupport(org.springframework.social.connect.web.ConnectSupport connectSupport) voidsetProfileService(ProfileService profileService) voidsetTextEncryptor(org.craftercms.commons.crypto.TextEncryptor textEncryptor) Starts the OAuth login process.start(String tenant, String providerId, javax.servlet.http.HttpServletRequest request, org.springframework.util.MultiValueMap<String, String> additionalUrlParams) Starts the OAuth login process.start(String tenant, String providerId, javax.servlet.http.HttpServletRequest request, org.springframework.util.MultiValueMap<String, String> additionalUrlParams, org.springframework.social.connect.web.ConnectSupport connectSupport) Starts the OAuth login process.protected ProfileupdateProfileConnectionData(String tenant, org.springframework.social.connect.Connection<?> connection, Profile profile)
-
Field Details
-
PARAM_OAUTH_TOKEN
- See Also:
-
PARAM_CODE
- See Also:
-
PARAM_ERROR
- See Also:
-
PARAM_ERROR_DESCRIPTION
- See Also:
-
PARAM_ERROR_URI
- See Also:
-
connectSupport
protected org.springframework.social.connect.web.ConnectSupport connectSupport -
connectionFactoryLocator
protected org.springframework.social.connect.ConnectionFactoryLocator connectionFactoryLocator -
profileService
-
authenticationManager
-
textEncryptor
protected org.craftercms.commons.crypto.TextEncryptor textEncryptor
-
-
Constructor Details
-
ProviderLoginSupportImpl
public ProviderLoginSupportImpl()
-
-
Method Details
-
setConnectSupport
public void setConnectSupport(org.springframework.social.connect.web.ConnectSupport connectSupport) -
setConnectionFactoryLocator
public void setConnectionFactoryLocator(org.springframework.social.connect.ConnectionFactoryLocator connectionFactoryLocator) -
setProfileService
-
setAuthenticationManager
-
setTextEncryptor
public void setTextEncryptor(org.craftercms.commons.crypto.TextEncryptor textEncryptor) -
start
public String start(String tenant, String providerId, javax.servlet.http.HttpServletRequest request) throws AuthenticationException Description copied from interface:ProviderLoginSupportStarts the OAuth login process. Returns a URL that the app should redirect to.- Specified by:
startin interfaceProviderLoginSupport- Parameters:
tenant- the current tenant the authenticated user belongs tooproviderId- the social service provider ID: facebook, twitter, linkedinrequest- the current request- Returns:
- the provider specific URL the current app should redirect too.
- Throws:
AuthenticationException
-
start
public String start(String tenant, String providerId, javax.servlet.http.HttpServletRequest request, org.springframework.util.MultiValueMap<String, String> additionalUrlParams) throws AuthenticationExceptionDescription copied from interface:ProviderLoginSupportStarts the OAuth login process. Returns a URL that the app should redirect to.- Specified by:
startin interfaceProviderLoginSupport- Parameters:
tenant- the current tenant the authenticated user belongs tooproviderId- the social service provider ID: facebook, twitter, linkedinrequest- the current requestadditionalUrlParams- additional parameters that should be added to the redirect URL- Returns:
- the provider specific URL the current app should redirect too.
- Throws:
AuthenticationException
-
start
public String start(String tenant, String providerId, javax.servlet.http.HttpServletRequest request, org.springframework.util.MultiValueMap<String, String> additionalUrlParams, org.springframework.social.connect.web.ConnectSupport connectSupport) throws AuthenticationExceptionDescription copied from interface:ProviderLoginSupportStarts the OAuth login process. Returns a URL that the app should redirect to.- Specified by:
startin interfaceProviderLoginSupport- Parameters:
tenant- the current tenant the authenticated user belongs tooproviderId- the social service provider ID: facebook, twitter, linkedinrequest- the current requestadditionalUrlParams- additional parameters that should be added to the redirect URLconnectSupport- helper class instance for establishing the connections with the providers- Returns:
- the provider specific URL the current app should redirect too.
- Throws:
AuthenticationException
-
complete
public Authentication complete(String tenant, String providerId, javax.servlet.http.HttpServletRequest request) throws AuthenticationException Description copied from interface:ProviderLoginSupportCompletes the OAuth authentication, returning the resultingAuthenticationobject, or null if it couldn't be completed.- Specified by:
completein interfaceProviderLoginSupport- Parameters:
tenant- the current tenant the authenticated user belongs tooproviderId- the social service provider ID: facebook, twitter, linkedinrequest- the current request- Returns:
- the authentication
- Throws:
AuthenticationException
-
complete
public Authentication complete(String tenant, String providerId, javax.servlet.http.HttpServletRequest request, Set<String> newUserRoles, Map<String, Object> newUserAttributes) throws AuthenticationExceptionDescription copied from interface:ProviderLoginSupportCompletes the OAuth authentication, returning the resultingAuthenticationobject, or null if it couldn't be completed.- Specified by:
completein interfaceProviderLoginSupport- Parameters:
tenant- the current tenant the authenticated user belongs tooproviderId- the social service provider ID: facebook, twitter, linkedinrequest- the current requestnewUserRoles- roles to add to a new usernewUserAttributes- attributes to add to a new user- Returns:
- the authentication
- Throws:
AuthenticationException
-
complete
public Authentication complete(String tenant, String providerId, javax.servlet.http.HttpServletRequest request, Set<String> newUserRoles, Map<String, Object> newUserAttributes, org.springframework.social.connect.web.ConnectSupport connectSupport) throws AuthenticationExceptionDescription copied from interface:ProviderLoginSupportCompletes the OAuth authentication, returning the resultingAuthenticationobject, or null if it couldn't be completed.- Specified by:
completein interfaceProviderLoginSupport- Parameters:
tenant- the current tenant the authenticated user belongs tooproviderId- the social service provider ID: facebook, twitter, linkedinrequest- the current requestnewUserRoles- roles to add to a new usernewUserAttributes- attributes to add to a new userconnectSupport- helper class instance for establishing the connections with the providers- Returns:
- the authentication
- Throws:
AuthenticationException
-
completeConnection
protected org.springframework.social.connect.Connection<?> completeConnection(org.springframework.social.connect.web.ConnectSupport connectSupport, String providerId, javax.servlet.http.HttpServletRequest request) throws OAuth2Exception - Throws:
OAuth2Exception
-
getConnectionFactory
protected org.springframework.social.connect.ConnectionFactory<?> getConnectionFactory(String providerId) -
getProfile
-
createProfile
-
updateProfileConnectionData
-