org.idoox.security.client
Class Current

java.lang.Object
  extended byorg.idoox.security.client.Current

public abstract class Current
extends java.lang.Object

This class makes accessible environment specific interfaces such as PrinicipalAuthenticator, current Credentials, etc.

Since:
3.0
Component:
Security-Specific

Constructor Summary
Current()
           
 
Method Summary
abstract  PrincipalAuthenticator getAuthenticator()
          Returns default instance of PrincipalAuthenticator interface, which is used for authentication of principals.
abstract  PrincipalAuthenticator getAuthenticator(java.lang.String provider)
          Returns instance of PrincipalAuthenticator interface for given provider type.
abstract  Credentials[] getCredentials()
          Returns current credentials in use or NULL if none has been set.
abstract  java.lang.String getCurrentProvider()
          Returns current security provider name or null if none is set as current.
static Current getInstance()
          Returns default instance of Current class.
abstract  ClientSecurityProvider getProvider(java.lang.String name)
          Returns instance of the ClientSecurityProvider interface for given security provider name.
abstract  java.util.Properties getProviderProperties(java.lang.String name)
          Returns properties associated with given security provider.
abstract  java.lang.String[] getProviders()
          Returns array of available providers which can be used as the provider parameter in the getAuthenticator(String provider) method.
abstract  void registerProvider(java.lang.String name, java.lang.String implClassName)
          Registers PrincipalAuthenticator provider implementation with given name.
abstract  void resetCredentials()
          Removes all credentials from the current list.
abstract  void setCredentials(Credentials[] creds)
          Adds given array of credentials to the current ones.
abstract  void setCredentials(Credentials[] creds, java.util.Map parameters)
          Adds given array of credentials to the current ones.
abstract  void setCurrentProvider(java.lang.String name)
          Sets given provider as the current provider.
abstract  void setCurrentProvider(java.lang.String name, java.util.Map parameters)
          Sets given provider as the current provider.
abstract  void setCurrentThreadCredentials(Credentials[] creds)
          This method sets the credentials for current thread overriding the credentials, which were set using setCredentials() method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Current

public Current()
Method Detail

getInstance

public static Current getInstance()
Returns default instance of Current class.

Returns:
default instance of this class

getProviders

public abstract java.lang.String[] getProviders()
Returns array of available providers which can be used as the provider parameter in the getAuthenticator(String provider) method.

Returns:
array of available provider names.
Since:
4.0

registerProvider

public abstract void registerProvider(java.lang.String name,
                                      java.lang.String implClassName)
Registers PrincipalAuthenticator provider implementation with given name. The implementation class must implement the org.idoox.security.PrincipalAuthenticatorSPI interface.

Parameters:
name - name of the provider
implClassName - name of the implementation class
Since:
4.0

getProviderProperties

public abstract java.util.Properties getProviderProperties(java.lang.String name)
                                                    throws java.security.NoSuchProviderException
Returns properties associated with given security provider.

The properties contain some general characteristics of the security mechanism implemented by given provider, such as default quality of protection, description, etc.

Returns:
properties associated with given provider
Throws:
java.security.NoSuchProviderException
Since:
4.0

getCurrentProvider

public abstract java.lang.String getCurrentProvider()
Returns current security provider name or null if none is set as current.

Returns:
name of the current security provider

setCurrentProvider

public abstract void setCurrentProvider(java.lang.String name)
                                 throws java.security.NoSuchProviderException
Sets given provider as the current provider. After successfull call to this method all new Web Service calls will use this provider as a mechanism for authentication and message protection.

Parameters:
name - name of the provider to be set as the current one
Throws:
java.security.NoSuchProviderException
Since:
4.0

setCurrentProvider

public abstract void setCurrentProvider(java.lang.String name,
                                        java.util.Map parameters)
                                 throws java.security.NoSuchProviderException
Sets given provider as the current provider. After successfull call to this method all new Web Service calls will use this provider as a mechanism for authentication and message protection.

Parameters:
name - name of the provider to be set as the current one
parameters - additional parameters for the security provider
Throws:
java.security.NoSuchProviderException
Since:
4.0

getProvider

public abstract ClientSecurityProvider getProvider(java.lang.String name)
                                            throws java.security.NoSuchProviderException
Returns instance of the ClientSecurityProvider interface for given security provider name.

Returns:
implementation of the given security provider
Throws:
java.security.NoSuchProviderException
Since:
4.0

getAuthenticator

public abstract PrincipalAuthenticator getAuthenticator()
Returns default instance of PrincipalAuthenticator interface, which is used for authentication of principals.

Returns:
instance of PrincipalAuthenticator interface

getAuthenticator

public abstract PrincipalAuthenticator getAuthenticator(java.lang.String provider)
                                                 throws java.security.NoSuchProviderException
Returns instance of PrincipalAuthenticator interface for given provider type.

Parameters:
provider - name of the provider of the PrincipalAuthenticator
Returns:
instance of PrincipalAuthenticator interface for the given provider type
Throws:
java.security.NoSuchProviderException
Since:
4.0

getCredentials

public abstract Credentials[] getCredentials()
Returns current credentials in use or NULL if none has been set.

Returns:
current credentials

setCredentials

public abstract void setCredentials(Credentials[] creds)
Adds given array of credentials to the current ones.

Parameters:
creds - credentials to be set as current

setCredentials

public abstract void setCredentials(Credentials[] creds,
                                    java.util.Map parameters)
Adds given array of credentials to the current ones.

Parameters:
creds - credentials to be set as current
parameters - additional parameters for the security provider

setCurrentThreadCredentials

public abstract void setCurrentThreadCredentials(Credentials[] creds)
This method sets the credentials for current thread overriding the credentials, which were set using setCredentials() method. This is usefull, if the client needs to override current credentials for particular call, but does not want to disturb other client threads.

Parameters:
creds - credentials to be set as current thread current

resetCredentials

public abstract void resetCredentials()
Removes all credentials from the current list.