org.idoox.security.server
Class Current

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

public abstract class Current
extends java.lang.Object

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

Since:
4.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[] getCurrentAcceptingProviders()
          Returns names of the current security providers for incoming requests or null if none is set as current.
abstract  java.lang.String getCurrentInitiatingProvider()
          Returns current security provider name for outgoing calls or null if none is set as current.
static Current getInstance()
          Returns default instance of Current class.
abstract  ServerSecurityProvider getProvider(java.lang.String name)
          Returns instance of the ServerSecurityProvider 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  ReceivedCredentials getReceivedCredentials()
          Returns credentials of the caller
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 resetCredentials(java.util.Map parameters)
          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 setCurrentAcceptingProviders(java.lang.String[] name)
          Sets given provider as the current provider for accepting requests.
abstract  void setCurrentAcceptingProviders(java.lang.String[] name, java.util.Map parameters)
          Sets given provider as the current provider for accepting requests.
abstract  void setCurrentInitiatingProvider(java.lang.String name)
          Sets given provider as the current provider for initiating new calls to other Web Services.
abstract  void setCurrentInitiatingProvider(java.lang.String name, java.util.Map parameters)
          Sets given provider as the current provider for initiating new calls to other Web Services.
abstract  void setCurrentProvider(java.lang.String name)
          Sets given provider as the current provider for both initiating and accepting sides.
abstract  void setReceivedCredentials(ReceivedCredentials creds)
          Sets received credentials for this call.
 
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.

Parameters:
name - name of the provider for which the properties have to returned
Returns:
properties associated with given provider
Throws:
java.security.NoSuchProviderException - when given provider cannot be found
Since:
4.0

setCurrentProvider

public abstract void setCurrentProvider(java.lang.String name)
                                 throws java.security.NoSuchProviderException
Sets given provider as the current provider for both initiating and accepting sides.

After successfull call to this method all new incoming and outgoing 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 - when given provider cannot be found
Since:
4.0

getCurrentInitiatingProvider

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

Returns:
name of the current security provider

setCurrentInitiatingProvider

public abstract void setCurrentInitiatingProvider(java.lang.String name)
                                           throws java.security.NoSuchProviderException
Sets given provider as the current provider for initiating new calls to other Web Services.

After successfull call to this method all new outgoing calls will use this provider as a mechanism for authentication and messsage protection.

Parameters:
name - name of the provider to be set as the current one for outgoing messages
Throws:
java.security.NoSuchProviderException - when given provider cannot be found
Since:
4.0

setCurrentInitiatingProvider

public abstract void setCurrentInitiatingProvider(java.lang.String name,
                                                  java.util.Map parameters)
                                           throws java.security.NoSuchProviderException
Sets given provider as the current provider for initiating new calls to other Web Services.

After successfull call to this method all new outgoing calls will use this provider as a mechanism for authentication and messsage protection.

Parameters:
name - name of the provider to be set as the current one for outgoing messages
parameters - additional parameters for the security provider
Throws:
java.security.NoSuchProviderException - when given provider cannot be found
Since:
4.0

getCurrentAcceptingProviders

public abstract java.lang.String[] getCurrentAcceptingProviders()
Returns names of the current security providers for incoming requests or null if none is set as current.

Returns:
array of names of the current security providers
Since:
4.0

setCurrentAcceptingProviders

public abstract void setCurrentAcceptingProviders(java.lang.String[] name)
                                           throws java.security.NoSuchProviderException
Sets given provider as the current provider for accepting requests.

After successfull call to this method all new incoming requests will use this provider as a mechanism for authentication and messsage protection.

Parameters:
name - name of the provider to be set as the current one for incoming messages
Throws:
java.security.NoSuchProviderException - when given provider cannot be found
Since:
4.0

setCurrentAcceptingProviders

public abstract void setCurrentAcceptingProviders(java.lang.String[] name,
                                                  java.util.Map parameters)
                                           throws java.security.NoSuchProviderException
Sets given provider as the current provider for accepting requests.

After successfull call to this method all new incoming requests will use this provider as a mechanism for authentication and messsage protection.

Parameters:
name - name of the provider to be set as the current one for incoming messages
parameters - additionall parameters for the security providers
Throws:
java.security.NoSuchProviderException - when given provider cannot be found
Since:
4.0

getProvider

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

Parameters:
name - name of the provider to be returned
Returns:
implementation of the given security provider
Throws:
java.security.NoSuchProviderException - when given provider cannot be found
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 - when given provider cannot be found
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 - additionall parameters for the security providers

resetCredentials

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


resetCredentials

public abstract void resetCredentials(java.util.Map parameters)
Removes all credentials from the current list.

Parameters:
parameters - additionall parameters for the security providers

getReceivedCredentials

public abstract ReceivedCredentials getReceivedCredentials()
Returns credentials of the caller

Returns:
caller's credentials

setReceivedCredentials

public abstract void setReceivedCredentials(ReceivedCredentials creds)
Sets received credentials for this call.

This method should be used from the Security Provider implementation when the client is authenticated to the server.

This method must be called after the Web Service contexts are initialized (i.e. after the call is processed by WASP Dispatcher). Generally it means that this method can be used from the interceptors and header processors but not for example by transport drivers.

Parameters:
creds - ReceivedCredentials instance to be set for this call.