org.idoox.security
Class Config

java.lang.Object
  extended byorg.idoox.security.Config

public final class Config
extends java.lang.Object

This class represents configuration properties for the security classes. It can be initialized manually using init() method or on demand when the first getProperty method is called.

When on demand intialization is used, the location of the property file is determined from the idoox.security.config system property. If this file is not found or the property is not set, it uses default property file included in the distribution of standalone security module.

The location of the property file can specified either as filename with path or as URL with scheme resource:. For the later case, the ClassLoader is used to load property file using classpath.

Since:
3.0
Component:
Security-Specific

Constructor Summary
Config()
           
 
Method Summary
static java.lang.String getId()
          Returns id of this configuration.
static java.lang.ClassLoader getImplClassLoader()
          Returns class loader for these configuration.
static java.util.Properties getProperties()
          Returns a copy of current of security properties.
static java.lang.String getProperty(java.lang.String key)
          Returns property value for given name.
static java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue)
          Returns property value for given name.
static void init(java.util.Properties properties, java.lang.ClassLoader implLoader)
          Method for explicit initialization of this class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Config

public Config()
Method Detail

getProperty

public static java.lang.String getProperty(java.lang.String key)
Returns property value for given name. The method returns null if property is not found.

Parameters:
key - the property key
Returns:
the value for the specified key

getProperty

public static java.lang.String getProperty(java.lang.String key,
                                           java.lang.String defaultValue)
Returns property value for given name. The method returns the default value argument if property is not found.

Parameters:
key - the property key
defaultValue - a default value
Returns:
the value for the specified key

getProperties

public static java.util.Properties getProperties()
Returns a copy of current of security properties.

Returns:
current security properties
Since:
4.0

getImplClassLoader

public static java.lang.ClassLoader getImplClassLoader()
Returns class loader for these configuration. For example, if we define security.provider.1=com.idoox.test.TestProvider, then new instance of this provider will be created using the class loader as follows Config.getImplClassLoader().getClass("com.idoox.test.TestProvider").newInstance().

Returns:
class loader for implementation classes.

getId

public static java.lang.String getId()
Returns id of this configuration. If we have more insntaces in one JVM under different class loader, we will have more configurations. Every instance of WASP has it own config.

Returns:

init

public static void init(java.util.Properties properties,
                        java.lang.ClassLoader implLoader)
Method for explicit initialization of this class. It allows to supply configuration values from other source than the default one.

Note that this method can be called before any other method on this class is called and only one time, RuntimeException is thrown otherwise.

The common property keys are: security.provider. gss.provider. gss.provider.default Cipher. Signature. MessageDigest. pstore.source pstore.provider pstore.source.sax.file userstore.source keystore.source userstore.impl keystore.impl

Parameters:
properties - properties containing the configuration for the security classes.