org.brickred.socialauth.oauthstrategy
Class Hybrid

java.lang.Object
  extended by org.brickred.socialauth.oauthstrategy.Hybrid
All Implemented Interfaces:
Serializable, OAuthStrategyBase

public class Hybrid
extends Object
implements OAuthStrategyBase

See Also:
Serialized Form

Constructor Summary
Hybrid(OAuthConfig config, Map<String,String> endpoints)
           
 
Method Summary
 Response executeFeed(String url)
          Makes HTTP GET request to a given URL.It attaches access token in URL if required.
 Response executeFeed(String url, String methodType, Map<String,String> params, Map<String,String> headerParams, String body)
          Makes HTTP request to a given URL.It attaches access token in URL if required.
 AccessGrant getAccessGrant()
          Retrieves the AccessGrant object.
 String getLoginRedirectURL(String successUrl)
          It provides the URL which will be used for authentication with the provider
 void logout()
          Logout
 void setAccessGrant(AccessGrant accessGrant)
          Stores access grant for the provider
 void setAccessTokenParameterName(String accessTokenParameterName)
          Sets the name of access token parameter which will returns by the provider.
 void setPermission(Permission permission)
          Sets the permission
 void setScope(String scope)
          Sets the scope string
 Response uploadImage(String url, String methodType, Map<String,String> params, Map<String,String> headerParams, String fileName, InputStream inputStream, String fileParamName)
          Makes HTTP request to upload image and status.
 AccessGrant verifyResponse(Map<String,String> requestParams)
          Verifies the user and get access token
 AccessGrant verifyResponse(Map<String,String> requestParams, String methodType)
          Verifies the user and get access token
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Hybrid

public Hybrid(OAuthConfig config,
              Map<String,String> endpoints)
Method Detail

getLoginRedirectURL

public String getLoginRedirectURL(String successUrl)
                           throws Exception
Description copied from interface: OAuthStrategyBase
It provides the URL which will be used for authentication with the provider

Specified by:
getLoginRedirectURL in interface OAuthStrategyBase
Parameters:
successUrl - the call back url on which user will be redirected after authentication
Returns:
the authentication url
Throws:
Exception

verifyResponse

public AccessGrant verifyResponse(Map<String,String> requestParams)
                           throws Exception
Description copied from interface: OAuthStrategyBase
Verifies the user and get access token

Specified by:
verifyResponse in interface OAuthStrategyBase
Parameters:
requestParams - request parameters, received from the provider
Returns:
AccessGrant which contains access token and other information
Throws:
Exception

verifyResponse

public AccessGrant verifyResponse(Map<String,String> requestParams,
                                  String methodType)
                           throws Exception
Description copied from interface: OAuthStrategyBase
Verifies the user and get access token

Specified by:
verifyResponse in interface OAuthStrategyBase
Returns:
AccessGrant which contains access token and other attributes
Throws:
Exception

executeFeed

public Response executeFeed(String url)
                     throws Exception
Description copied from interface: OAuthStrategyBase
Makes HTTP GET request to a given URL.It attaches access token in URL if required.

Specified by:
executeFeed in interface OAuthStrategyBase
Parameters:
url - URL to make HTTP request.
Returns:
Response object
Throws:
Exception

executeFeed

public Response executeFeed(String url,
                            String methodType,
                            Map<String,String> params,
                            Map<String,String> headerParams,
                            String body)
                     throws Exception
Description copied from interface: OAuthStrategyBase
Makes HTTP request to a given URL.It attaches access token in URL if required.

Specified by:
executeFeed in interface OAuthStrategyBase
Parameters:
url - URL to make HTTP request.
methodType - Method type can be GET, POST or PUT
params - Not using this parameter in Google API function
headerParams - Parameters need to pass as Header Parameters
body - Request Body
Throws:
Exception

setPermission

public void setPermission(Permission permission)
Description copied from interface: OAuthStrategyBase
Sets the permission

Specified by:
setPermission in interface OAuthStrategyBase
Parameters:
permission - Permission object which can be Permission.AUHTHENTICATE_ONLY, Permission.ALL, Permission.DEFAULT

setScope

public void setScope(String scope)
Description copied from interface: OAuthStrategyBase
Sets the scope string

Specified by:
setScope in interface OAuthStrategyBase
Parameters:
scope - scope string

setAccessGrant

public void setAccessGrant(AccessGrant accessGrant)
Description copied from interface: OAuthStrategyBase
Stores access grant for the provider

Specified by:
setAccessGrant in interface OAuthStrategyBase
Parameters:
accessGrant - It contains the access token and other information

setAccessTokenParameterName

public void setAccessTokenParameterName(String accessTokenParameterName)
Description copied from interface: OAuthStrategyBase
Sets the name of access token parameter which will returns by the provider. By default it is "access_token"

Specified by:
setAccessTokenParameterName in interface OAuthStrategyBase

logout

public void logout()
Description copied from interface: OAuthStrategyBase
Logout

Specified by:
logout in interface OAuthStrategyBase

uploadImage

public Response uploadImage(String url,
                            String methodType,
                            Map<String,String> params,
                            Map<String,String> headerParams,
                            String fileName,
                            InputStream inputStream,
                            String fileParamName)
                     throws Exception
Description copied from interface: OAuthStrategyBase
Makes HTTP request to upload image and status.

Specified by:
uploadImage in interface OAuthStrategyBase
Parameters:
url - URL to make HTTP request.
methodType - Method type can be GET, POST or PUT
params - Parameters need to pass in request
headerParams - Parameters need to pass as Header Parameters
fileName - Image file name
inputStream - Input stream of image
fileParamName - Image Filename parameter. It requires in some provider.
Returns:
Response object
Throws:
Exception

getAccessGrant

public AccessGrant getAccessGrant()
Description copied from interface: OAuthStrategyBase
Retrieves the AccessGrant object.

Specified by:
getAccessGrant in interface OAuthStrategyBase
Returns:
AccessGrant object.


Copyright © 2013. All Rights Reserved.