org.brickred.socialauth
Class AbstractProvider

java.lang.Object
  extended by org.brickred.socialauth.AbstractProvider
All Implemented Interfaces:
Serializable, AuthProvider
Direct Known Subclasses:
FacebookImpl, FlickerImpl, FourSquareImpl, GenericOAuth1Provider, GenericOAuth2Provider, GitHubImpl, GoogleImpl, GooglePlusImpl, HotmailImpl, InstagramImpl, LinkedInImpl, LinkedInOAuth2Impl, MendeleyImpl, MySpaceImpl, NimbleImpl, OpenIdImpl, RunkeeperImpl, SalesForceImpl, TwitterImpl, YahooImpl, YammerImpl

public abstract class AbstractProvider
extends Object
implements AuthProvider, Serializable

It implements AuthProvider interface and provides some methods for registering and getting plugins.

Author:
tarunn@brickred.com
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
AbstractProvider()
           
 
Method Summary
protected abstract  OAuthStrategyBase getOauthStrategy()
          Returns the OAuthStrategyBase of a provider.
<T> T
getPlugin(Class<T> clazz)
          Returns the required plugin if provider support that.
protected abstract  List<String> getPluginsList()
          Returns the list of plugins of a provider.
 String getPluginsScope(OAuthConfig oauthConfig)
          Returns the scopes of custom plugins of a provider those are configured in properties file
 boolean isSupportedPlugin(Class<? extends Plugin> clazz)
          Returns True if provider support given plugin otherwise returns False
 void refreshToken(AccessGrant accessGrant)
          Makes a call for a provider to get RefreshToken and returns object of that provider
 void registerPlugins()
          Registers plugin for a provider those are configured in configuration properties or mentioned in provider implementation.
 
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
api, getAccessGrant, getContactList, getLoginRedirectURL, getProviderId, getUserProfile, logout, setAccessGrant, setPermission, updateStatus, uploadImage, verifyResponse
 

Constructor Detail

AbstractProvider

public AbstractProvider()
                 throws Exception
Throws:
Exception
Method Detail

getPlugin

public <T> T getPlugin(Class<T> clazz)
            throws Exception
Description copied from interface: AuthProvider
Returns the required plugin if provider support that.

Specified by:
getPlugin in interface AuthProvider
Parameters:
clazz - Fully qualified plugin class name e.g org.brickred.socialauth.plugin.FeedPlugin.class
Returns:
the required plugin object
Throws:
Exception

isSupportedPlugin

public boolean isSupportedPlugin(Class<? extends Plugin> clazz)
Description copied from interface: AuthProvider
Returns True if provider support given plugin otherwise returns False

Specified by:
isSupportedPlugin in interface AuthProvider
Parameters:
clazz - Fully qualified plugin class name e.g org.brickred.socialauth.plugin.FeedPlugin.class
Returns:
true if provider supports plugin otherwise false

registerPlugins

public final void registerPlugins()
                           throws Exception
Description copied from interface: AuthProvider
Registers plugin for a provider those are configured in configuration properties or mentioned in provider implementation.

Specified by:
registerPlugins in interface AuthProvider
Throws:
Exception

refreshToken

public void refreshToken(AccessGrant accessGrant)
                  throws SocialAuthException
Description copied from interface: AuthProvider
Makes a call for a provider to get RefreshToken and returns object of that provider

Specified by:
refreshToken in interface AuthProvider
Parameters:
accessGrant - AccessGrant which contains AccessToken
Throws:
SocialAuthException

getPluginsScope

public String getPluginsScope(OAuthConfig oauthConfig)
Returns the scopes of custom plugins of a provider those are configured in properties file

Parameters:
oauthConfig - OAuthConfig object of that provider
Returns:
String of comma separated scopes of all register plugins of a provider those are configured in properties file

getPluginsList

protected abstract List<String> getPluginsList()
Returns the list of plugins of a provider.

Returns:
List of plugins of a provider

getOauthStrategy

protected abstract OAuthStrategyBase getOauthStrategy()
Returns the OAuthStrategyBase of a provider.

Returns:
OAuthStrategyBase of a provider.


Copyright © 2014. All rights reserved.