org.brickred.socialauth.provider
Class InstagramImpl

java.lang.Object
  extended by org.brickred.socialauth.AbstractProvider
      extended by org.brickred.socialauth.provider.InstagramImpl
All Implemented Interfaces:
Serializable, AuthProvider

public class InstagramImpl
extends AbstractProvider

Provider implementation for Instagram

Author:
Psychas Konstantinos
See Also:
Serialized Form

Field Summary
static String CLASSID
           
 
Fields inherited from interface org.brickred.socialauth.AuthProvider
COUNTRY, DOB, EMAIL, EXT_NAMESPACE, FIRST_NAME, FULL_NAME, GENDER, LANGUAGE, LAST_NAME, NICK_NAME, POSTCODE
 
Constructor Summary
InstagramImpl(OAuthConfig providerConfig)
           
 
Method Summary
 Response api(String url, String methodType, Map<String,String> params, Map<String,String> headerParams, String body)
          Makes OAuth signed HTTP request to a given URL for making any provider specific calls.
 AccessGrant getAccessGrant()
          Retrieves the AccessGrant object.
 List<Contact> getContactList()
          Gets the list of contacts of the user and their email.
 String getLoginRedirectURL(String successUrl)
          This is the most important action.
protected  OAuthStrategyBase getOauthStrategy()
          Returns the OAuthStrategyBase of a provider.
protected  List<String> getPluginsList()
          Returns the list of plugins of a provider.
 String getProviderId()
          Retrieves the provider id
 Profile getUserProfile()
          Retrieves the user profile.
 void logout()
          Logout
 void setAccessGrant(AccessGrant accessGrant)
          Stores access grant for the provider *
 void setPermission(Permission p)
           
 Response updateStatus(String msg)
          Updates the status on the chosen provider if available.
 Response uploadImage(String message, String fileName, InputStream inputStream)
          Updates the image and message on the chosen provider if available.
 Profile verifyResponse(Map<String,String> requestParams)
          Verifies the user when the external provider redirects back to our application.
 
Methods inherited from class org.brickred.socialauth.AbstractProvider
getPlugin, getPluginsScope, isSupportedPlugin, refreshToken, registerPlugins
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASSID

public static final String CLASSID
See Also:
Constant Field Values
Constructor Detail

InstagramImpl

public InstagramImpl(OAuthConfig providerConfig)
              throws Exception
Throws:
Exception
Method Detail

api

public Response api(String url,
                    String methodType,
                    Map<String,String> params,
                    Map<String,String> headerParams,
                    String body)
             throws Exception
Description copied from interface: AuthProvider
Makes OAuth signed HTTP request to a given URL for making any provider specific calls. For more information, read the comments of this function in different provider.

Parameters:
url - URL to make HTTP request.
methodType - Method type can be GET, POST or PUT
params - Any additional parameters whose signature need to compute. Only used in case of "POST" and "PUT" method type.
headerParams - Any additional parameters need to pass as Header Parameters
body - Request Body
Returns:
Response object
Throws:
Exception

getAccessGrant

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

Returns:
AccessGrant object.

getContactList

public List<Contact> getContactList()
                             throws Exception
Description copied from interface: AuthProvider
Gets the list of contacts of the user and their email. this may not be available for all providers.

Returns:
List of profile objects representing Contacts. Only name and email will be available
Throws:
Exception

getLoginRedirectURL

public String getLoginRedirectURL(String successUrl)
                           throws Exception
Description copied from interface: AuthProvider
This is the most important action. It redirects the browser to an appropriate URL which will be used for authentication with the provider that has been set using setId()

Throws:
Exception

getProviderId

public String getProviderId()
Description copied from interface: AuthProvider
Retrieves the provider id

Returns:
provider id.

getUserProfile

public Profile getUserProfile()
                       throws Exception
Description copied from interface: AuthProvider
Retrieves the user profile.

Returns:
Profile object containing the profile information.
Throws:
Exception

logout

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


setAccessGrant

public void setAccessGrant(AccessGrant accessGrant)
                    throws AccessTokenExpireException
Description copied from interface: AuthProvider
Stores access grant for the provider *

Parameters:
accessGrant - It contains the access token and other information
Throws:
AccessTokenExpireException

setPermission

public void setPermission(Permission p)
Parameters:
p - Permission object which can be Permission.AUHTHENTICATE_ONLY, Permission.ALL, Permission.DEFAULT

updateStatus

public Response updateStatus(String msg)
                      throws Exception
Description copied from interface: AuthProvider
Updates the status on the chosen provider if available. This may not be implemented for all providers.

Parameters:
msg - Message to be shown as user's status
Throws:
Exception

uploadImage

public Response uploadImage(String message,
                            String fileName,
                            InputStream inputStream)
                     throws Exception
Description copied from interface: AuthProvider
Updates the image and message on the chosen provider if available. This is implemented only for Facebook and Twitter.

Parameters:
message - Status Message
fileName - Image file name
inputStream - Input Stream of image
Returns:
Response object
Throws:
Exception

verifyResponse

public Profile verifyResponse(Map<String,String> requestParams)
                       throws Exception
Description copied from interface: AuthProvider
Verifies the user when the external provider redirects back to our application.

Parameters:
requestParams - Request parameters received from the provider
Returns:
AuthProvider object
Throws:
Exception

getOauthStrategy

protected OAuthStrategyBase getOauthStrategy()
Description copied from class: AbstractProvider
Returns the OAuthStrategyBase of a provider.

Specified by:
getOauthStrategy in class AbstractProvider
Returns:
OAuthStrategyBase of a provider.

getPluginsList

protected List<String> getPluginsList()
Description copied from class: AbstractProvider
Returns the list of plugins of a provider.

Specified by:
getPluginsList in class AbstractProvider
Returns:
List of plugins of a provider


Copyright © 2014. All rights reserved.