org.brickred.socialauth
Class AuthProviderFactory

java.lang.Object
  extended by org.brickred.socialauth.AuthProviderFactory

public class AuthProviderFactory
extends Object

This is a factory which creates an instance of the requested provider based on the string passed as id. Currently available providers are facebook, foursquare, google, hotmail, linkedin,myspace, openid, twitter, yahoo . If requested provider id is not matched, it returns the OpenId provider.

Author:
tarunn@brickred.com

Constructor Summary
AuthProviderFactory()
           
 
Method Summary
static AuthProvider getInstance(String id)
          It provides the instance of requested provider
static AuthProvider getInstance(String id, ClassLoader classLoader)
           
static AuthProvider getInstance(String id, Properties properties)
           
static AuthProvider getInstance(String id, String propertiesFileName)
           
static AuthProvider getInstance(String id, String propertiesFileName, ClassLoader classLoader)
           
static void registerProvider(String pname, Class clazz)
          It register a new provider in AuthProviderFactory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AuthProviderFactory

public AuthProviderFactory()
Method Detail

getInstance

public static AuthProvider getInstance(String id)
                                throws Exception
It provides the instance of requested provider

Parameters:
id - the id of requested provider. It can be facebook, foursquare, google, hotmail, linkedin,myspace, twitter, yahoo
Returns:
AuthProvider the instance of requested provider based on given id. If id is a URL it returns the OpenId provider.
Throws:
Exception

getInstance

public static AuthProvider getInstance(String id,
                                       String propertiesFileName)
                                throws Exception
Parameters:
id - the id of requested provider. It can be facebook, foursquare, google, hotmail, linkedin,myspace, twitter, yahoo.
propertiesFileName - file name to read the properties
Returns:
AuthProvider the instance of requested provider based on given id. If id is a URL it returns the OpenId provider.
Throws:
Exception

getInstance

public static AuthProvider getInstance(String id,
                                       ClassLoader classLoader)
                                throws Exception
Parameters:
id - the id of requested provider. It can be facebook, foursquare, google, hotmail, linkedin,myspace, twitter, yahoo.
classLoader - classloader to load the properties
Returns:
AuthProvider the instance of requested provider based on given id. If id is a URL it returns the OpenId provider.
Throws:
Exception

getInstance

public static AuthProvider getInstance(String id,
                                       String propertiesFileName,
                                       ClassLoader classLoader)
                                throws Exception
Parameters:
id - the id of requested provider. It can be facebook, foursquare, google, hotmail, linkedin,myspace, twitter, yahoo.
propertiesFileName - file name to read the properties
classLoader - classloader to load the properties
Returns:
AuthProvider the instance of requested provider based on given id. If id is a URL it returns the OpenId provider.
Throws:
Exception

getInstance

public static AuthProvider getInstance(String id,
                                       Properties properties)
                                throws Exception
Parameters:
id - the id of requested provider. It can be facebook, foursquare, google, hotmail, linkedin,myspace, twitter, yahoo.
properties - properties containing key/secret for different providers and information of custom provider.
Returns:
AuthProvider the instance of requested provider based on given id. If id is a URL it returns the OpenId provider.
Throws:
Exception

registerProvider

public static void registerProvider(String pname,
                                    Class clazz)
It register a new provider in AuthProviderFactory.

Parameters:
pname - provider name
clazz - class name of the provider implementation.


Copyright © 2013. All Rights Reserved.