org.brickred.socialauth.provider
Class OpenIdImpl

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

public class OpenIdImpl
extends AbstractProvider
implements AuthProvider, Serializable

Implementation of Open ID provider. Currently only name and email has been implemented as part of profile. Other functionality like updating status and importing contacts is not available for generic Open ID providers

See Also:
Serialized Form

Field Summary
 
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
OpenIdImpl(OAuthConfig config)
           
OpenIdImpl(Properties props)
           
 
Method Summary
 Response api(String url, String methodType, Map<String,String> params, Map<String,String> headerParams, String body)
          Not implemented for OpenId provider.
 AccessGrant getAccessGrant()
          Retrieves the AccessGrant object.
 List<Contact> getContactList()
          Contact list is not available for generic Open ID providers.
 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)
           
 void updateStatus(String msg)
          Updating status is not available for generic Open ID providers.
 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, registerPlugins
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.brickred.socialauth.AuthProvider
getPlugin, isSupportedPlugin, registerPlugins
 

Constructor Detail

OpenIdImpl

public OpenIdImpl(Properties props)
           throws org.openid4java.consumer.ConsumerException,
                  Exception
Throws:
org.openid4java.consumer.ConsumerException
Exception

OpenIdImpl

public OpenIdImpl(OAuthConfig config)
           throws org.openid4java.consumer.ConsumerException,
                  Exception
Throws:
org.openid4java.consumer.ConsumerException
Exception
Method Detail

setAccessGrant

public void setAccessGrant(AccessGrant accessGrant)
                    throws org.openid4java.consumer.ConsumerException
Description copied from interface: AuthProvider
Stores access grant for the provider *

Specified by:
setAccessGrant in interface AuthProvider
Parameters:
accessGrant - It contains the access token and other information
Throws:
org.openid4java.consumer.ConsumerException

getLoginRedirectURL

public String getLoginRedirectURL(String successUrl)
                           throws IOException
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()

Specified by:
getLoginRedirectURL in interface AuthProvider
Throws:
Exception
IOException

verifyResponse

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

Specified by:
verifyResponse in interface AuthProvider
Parameters:
requestParams - request parameters, received from the provider
Returns:
Profile object containing the profile information
Throws:
Exception

updateStatus

public void updateStatus(String msg)
                  throws Exception
Updating status is not available for generic Open ID providers.

Specified by:
updateStatus in interface AuthProvider
Parameters:
msg - Message to be shown as user's status
Throws:
Exception

getContactList

public List<Contact> getContactList()
Contact list is not available for generic Open ID providers.

Specified by:
getContactList in interface AuthProvider
Returns:
null

logout

public void logout()
Logout

Specified by:
logout in interface AuthProvider

setPermission

public void setPermission(Permission p)
Specified by:
setPermission in interface AuthProvider
Parameters:
p - Permission object which can be Permission.AUHTHENTICATE_ONLY, Permission.ALL, Permission.DEFAULT

api

public Response api(String url,
                    String methodType,
                    Map<String,String> params,
                    Map<String,String> headerParams,
                    String body)
             throws Exception
Not implemented for OpenId provider.

Specified by:
api in interface AuthProvider
Parameters:
url -
methodType -
params -
headerParams -
body -
Returns:
Response object
Throws:
Exception

getUserProfile

public Profile getUserProfile()
Retrieves the user profile. Null in case of OpenId provider.

Specified by:
getUserProfile in interface AuthProvider
Returns:
Profile object containing the profile information.

getAccessGrant

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

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

getProviderId

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

Specified by:
getProviderId in interface AuthProvider
Returns:
provider id.

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.

Specified by:
uploadImage in interface AuthProvider
Parameters:
message - Status Message
fileName - Image file name
inputStream - Input Stream of image
Returns:
Response 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 © 2013. All Rights Reserved.