org.brickred.socialauth
Class SocialAuthConfig

java.lang.Object
  extended by org.brickred.socialauth.SocialAuthConfig
All Implemented Interfaces:
Serializable

public class SocialAuthConfig
extends Object
implements Serializable

This class is used to load the configuration for all providers. Load() method is used to upload the configuration. Configuration can be loaded through InputStream, Properties or from file. An instance of this class is passed to SocialAuthManager for configuring providers.

Author:
tarunn@brickred.com
See Also:
Serialized Form

Constructor Summary
SocialAuthConfig()
           
 
Method Summary
 void addProvider(String pname, Class<?> clazz)
          Registers a new provider implementation.
 void addProviderConfig(String providerId, OAuthConfig config)
          Updates the provider specific configuration.
 Properties getApplicationProperties()
          Returns the application configuration properties
static SocialAuthConfig getDefault()
          Returns the instance of SocialAuthConfig
 OAuthConfig getProviderConfig(String id)
          Retrieves the configuration of given provider
protected  boolean isConfigSetup()
           
 void load()
          Loads the application properties from oauth_consumer.properties file.
 void load(InputStream inputStream)
          Loads the application configuration from the given input stream Format of the input stream should be as follows:
www.google.com.consumer_key = opensource.brickred.com
 void load(Properties properties)
          Loads the application configuration from the given properties
 void load(String fileName)
          Loads the application configuration from the given file
 void setApplicationProperties(Properties applicationProperties)
          Setter for application configuration properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SocialAuthConfig

public SocialAuthConfig()
Method Detail

getDefault

public static SocialAuthConfig getDefault()
Returns the instance of SocialAuthConfig

Returns:
SocialAuthConfig default object

addProvider

public void addProvider(String pname,
                        Class<?> clazz)
                 throws Exception
Registers a new provider implementation.

Parameters:
pname - provider name or id
clazz - class name of the provider implementation.
Throws:
Exception

getApplicationProperties

public Properties getApplicationProperties()
Returns the application configuration properties

Returns:
the application configuration properties

setApplicationProperties

public void setApplicationProperties(Properties applicationProperties)
                              throws Exception
Setter for application configuration properties.

Parameters:
applicationProperties - the application configuration properties
Throws:
Exception

load

public void load(InputStream inputStream)
          throws Exception
Loads the application configuration from the given input stream Format of the input stream should be as follows:
www.google.com.consumer_key = opensource.brickred.com

Parameters:
inputStream - property file input stream which contains the configuration.
Throws:
Exception

load

public void load(Properties properties)
          throws Exception
Loads the application configuration from the given properties

Parameters:
properties - application configuration properties
Throws:
Exception

load

public void load(String fileName)
          throws Exception
Loads the application configuration from the given file

Parameters:
fileName - the file name which contains the application configuration properties
Throws:
Exception

load

public void load()
          throws Exception
Loads the application properties from oauth_consumer.properties file.

Throws:
Exception

addProviderConfig

public void addProviderConfig(String providerId,
                              OAuthConfig config)
                       throws Exception
Updates the provider specific configuration.

Parameters:
providerId - the provider id for which configuration need to be add or update
config - the OAuthConfig object which contains the configuration.
Throws:
Exception

getProviderConfig

public OAuthConfig getProviderConfig(String id)
                              throws Exception
Retrieves the configuration of given provider

Parameters:
id - the provider id
Returns:
the configuration of given provider
Throws:
Exception

isConfigSetup

protected boolean isConfigSetup()


Copyright © 2013. All Rights Reserved.