public class SocialAuthManager extends Object implements Serializable
| Constructor and Description |
|---|
SocialAuthManager() |
| Modifier and Type | Method and Description |
|---|---|
AuthProvider |
connect(AccessGrant accessGrant)
Creates the provider with given access grant
|
AuthProvider |
connect(Map<String,String> requestParams)
Verifies the user when the external provider redirects back to our
application.
|
AccessGrant |
createAccessGrant(String providerId,
Map<String,String> params,
String redirectURL) |
AccessGrant |
createAccessGrant(String providerId,
String authCode,
String redirectURL)
Generates access token and creates a object of AccessGrant
|
boolean |
disconnectProvider(String id)
It disconnects with provider
|
String |
getAuthenticationUrl(String id,
String successUrl)
This is the most important action.
|
String |
getAuthenticationUrl(String id,
String successUrl,
Permission permission)
This is the most important action.
|
List<String> |
getConnectedProvidersIds()
Returns the array list of connected providers ids.
|
AuthProvider |
getCurrentAuthProvider()
Retrieves the current auth provider instance which is last connected.
|
AuthProvider |
getProvider(String providerId)
Retrieves the instance of given provider
|
SocialAuthConfig |
getSocialAuthConfig()
Retrieves the socialauth config
|
boolean |
isConnected(String providerId)
Returns True if given provider is connected otherwise returns False
|
AuthProvider |
refreshToken(AccessGrant accessGrant)
Makes a call for a provider to get RefreshToken and returns object of
that provider
|
void |
setPermission(String providerId,
Permission permission)
Sets the permission for given provider.
|
void |
setSocialAuthConfig(SocialAuthConfig socialAuthConfig)
Updates the socialauth config
|
public SocialAuthConfig getSocialAuthConfig()
public void setSocialAuthConfig(SocialAuthConfig socialAuthConfig) throws Exception
socialAuthConfig - the SocialAuthConfig object which contains the configuration
for providersExceptionpublic String getAuthenticationUrl(String id, String successUrl) throws Exception
id - the provider idsuccessUrl - success page URL on which provider will redirect after
authenticationExceptionpublic String getAuthenticationUrl(String id, String successUrl, Permission permission) throws Exception
id - the provider idsuccessUrl - success page URL on which provider will redirect after
authenticationpermission - Permission object which can be Permission.AUHTHENTICATE_ONLY,
Permission.ALL, Permission.DEFAULTExceptionpublic AuthProvider connect(Map<String,String> requestParams) throws Exception
requestParams - the request parametersExceptionpublic AccessGrant createAccessGrant(String providerId, String authCode, String redirectURL) throws Exception
providerId - the provider idauthCode - auth code for generating access tokenredirectURL - return url which is given while registering app with provider
to generate client id and secretExceptionpublic AccessGrant createAccessGrant(String providerId, Map<String,String> params, String redirectURL) throws Exception
Exceptionpublic boolean disconnectProvider(String id)
id - the provider idpublic AuthProvider connect(AccessGrant accessGrant) throws SocialAuthConfigurationException, AccessTokenExpireException, SocialAuthException
accessGrant - the access grant object which containsExceptionSocialAuthConfigurationExceptionAccessTokenExpireExceptionSocialAuthExceptionpublic AuthProvider refreshToken(AccessGrant accessGrant) throws SocialAuthConfigurationException, SocialAuthException
accessGrant - AccessGrant object which contains access tokenSocialAuthConfigurationExceptionSocialAuthExceptionpublic boolean isConnected(String providerId)
providerId - the provider idpublic AuthProvider getProvider(String providerId)
providerId - the provider idpublic List<String> getConnectedProvidersIds()
public AuthProvider getCurrentAuthProvider()
public void setPermission(String providerId, Permission permission)
providerId - the provider id for which permission need to be setpermission - Permission object which can be Permission.AUHTHENTICATE_ONLY,
Permission.ALL, Permission.DEFAULTCopyright © 2018. All Rights Reserved.