org.brickred.socialauth
Class SocialAuthManager

java.lang.Object
  extended by org.brickred.socialauth.SocialAuthManager
All Implemented Interfaces:
Serializable

public class SocialAuthManager
extends Object
implements Serializable

This class manages the Map of all the connected providers by using this manager.

Author:
tarunn@brickred.com
See Also:
Serialized Form

Constructor Summary
SocialAuthManager()
           
 
Method Summary
 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.
 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
 void setPermission(String providerId, Permission permission)
          Sets the permission for given provider.
 void setSocialAuthConfig(SocialAuthConfig socialAuthConfig)
          Updates the socialauth config
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SocialAuthManager

public SocialAuthManager()
Method Detail

getSocialAuthConfig

public SocialAuthConfig getSocialAuthConfig()
Retrieves the socialauth config

Returns:
the socialauth config

setSocialAuthConfig

public void setSocialAuthConfig(SocialAuthConfig socialAuthConfig)
                         throws Exception
Updates the socialauth config

Parameters:
socialAuthConfig - the SocialAuthConfig object which contains the configuration for providers
Throws:
Exception

getAuthenticationUrl

public String getAuthenticationUrl(String id,
                                   String successUrl)
                            throws Exception
This is the most important action. It provides the URL which will be used for authentication with the provider

Parameters:
id - the provider id
successUrl - success page URL on which provider will redirect after authentication
Returns:
the URL string which will be used for authentication with provider
Throws:
Exception

getAuthenticationUrl

public String getAuthenticationUrl(String id,
                                   String successUrl,
                                   Permission permission)
                            throws Exception
This is the most important action. It provides the URL which will be used for authentication with the provider

Parameters:
id - the provider id
successUrl - success page URL on which provider will redirect after authentication
permission - Permission object which can be Permission.AUHTHENTICATE_ONLY, Permission.ALL, Permission.DEFAULT
Returns:
the URL string which will be used for authentication with provider
Throws:
Exception

connect

public AuthProvider connect(Map<String,String> requestParams)
                     throws Exception
Verifies the user when the external provider redirects back to our application.

Parameters:
requestParams - the request parameters
Returns:
object of the required auth provider. You can call various function of this provider to get the information.
Throws:
Exception

disconnectProvider

public boolean disconnectProvider(String id)
It disconnects with provider

Parameters:
id - the provider id
Returns:
True if provider is disconnected or false if not.

connect

public AuthProvider connect(AccessGrant accessGrant)
                     throws Exception
Creates the provider with given access grant

Parameters:
accessGrant - the access grant object which contains
Returns:
the auth provider
Throws:
Exception

isConnected

public boolean isConnected(String providerId)
Returns True if given provider is connected otherwise returns False

Parameters:
providerId - the provider id
Returns:
provider connected status

getProvider

public AuthProvider getProvider(String providerId)
Retrieves the instance of given provider

Parameters:
providerId - the provider id
Returns:
the instance of given provider

getConnectedProvidersIds

public List<String> getConnectedProvidersIds()
Returns the array list of connected providers ids.

Returns:
List of connected providers ids string.

getCurrentAuthProvider

public AuthProvider getCurrentAuthProvider()
Retrieves the current auth provider instance which is last connected.

Returns:
AuthProvider object

setPermission

public void setPermission(String providerId,
                          Permission permission)
Sets the permission for given provider.

Parameters:
providerId - the provider id for which permission need to be set
permission - Permission object which can be Permission.AUHTHENTICATE_ONLY, Permission.ALL, Permission.DEFAULT


Copyright © 2013. All Rights Reserved.