com.caplin.keymaster
Class KeyMaster

java.lang.Object
  extended by com.caplin.keymaster.KeyMaster

public class KeyMaster
extends Object

Provides methods to generate the credentials token that can be passed back to the client, and that the client can use to log in to Liberator.

The instance of KeyMaster that is used to generate to the token must be configured and obtained by invoking the getKeyMaster(Properties) method. A unique token that can be used to log in to Liberator is obtained by invoking one of the generateToken() methods on that instance.

The name of the Logger used by KeyMaster can also be obtained from the LOGGERNAME static field.


Field Summary
static String LOGGERNAME
          The name of the Logger used by KeyMaster.
 
Method Summary
 String generateToken(String userName)
          Generates a unique credentials token that the client can use to log in to Liberator.
 String generateToken(String userName, Map<String,String> mappingData)
          Generates a unique credentials token that the client can use to log in to Liberator.
 String generateToken(String userName, String extraDataToSign)
          Generates a unique credentials token that the client can use to log in to Liberator.
 String generateToken(String userName, String extraDataToSign, Map<String,String> mappingData)
          Generates a unique credentials token that the client can use to log in to Liberator.
static KeyMaster getKeyMaster(Properties props)
          Gets a KeyMaster that has been configured with the specified properties.
 String getToken()
          Deprecated. 

The use case of generating a token without a username will not be supported in future versions.

Gets a unique token that a client can use to log into the Liberator.

 String getToken(String extraDataToSign)
          Deprecated. 

Use generateToken(String, String) instead.

Gets a unique token that a client can use to log into the Liberator.

The extraDataToSign argument can be used to sign extra information that can be passed to Liberator. This extra data will be signed as part of the generated token.

 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGERNAME

public static final String LOGGERNAME

The name of the Logger used by KeyMaster.

See Also:
Constant Field Values
Method Detail

getKeyMaster

public static KeyMaster getKeyMaster(Properties props)
                              throws WrappedException,
                                     InitialisationFailedException

Gets a KeyMaster that has been configured with the specified properties.

Parameters:
props - The properties that will be used to configure how the KeyMaster generates the token.
Returns:
A new KeyMaster.
Throws:
IllegalArgumentException - If the props argument is null.
WrappedException - Wraps an Exception that was thrown whilst trying to initialise the KeyMaster.
InitialisationFailedException - If a required property is missing from the props argument.

getToken

public String getToken()
                throws WrappedException
Deprecated. 

The use case of generating a token without a username will not be supported in future versions.

Gets a unique token that a client can use to log into the Liberator.

Returns:
The token that should be returned to the client.
Throws:
WrappedException - Wraps an Exception that was thrown whilst trying to generate the token.

getToken

public String getToken(String extraDataToSign)
                throws WrappedException
Deprecated. 

Use generateToken(String, String) instead.

Gets a unique token that a client can use to log into the Liberator.

The extraDataToSign argument can be used to sign extra information that can be passed to Liberator. This extra data will be signed as part of the generated token.

Parameters:
extraDataToSign - extra data that will be signed as part of the token.
Returns:
The token that should be returned to the client.
Throws:
WrappedException - Wraps an Exception that was thrown whilst trying to generate the token.

generateToken

public String generateToken(String userName)
                     throws WrappedException

Generates a unique credentials token that the client can use to log in to Liberator.

The parameters passed to this method are signed and available as part of the token.

Parameters:
userName - The username that is required to log in to Liberator.
Returns:
A unique credentials token that can be returned to the client.
Throws:
WrappedException - Wraps exceptions that KeyMaster throws when it attempts to generate the token.

generateToken

public String generateToken(String userName,
                            String extraDataToSign)
                     throws WrappedException

Generates a unique credentials token that the client can use to log in to Liberator.

The parameters passed to this method are signed and available as part of the token.

Parameters:
userName - The username that is required to log in to Liberator.
extraDataToSign - Extra data that will be signed and included in the token.
Returns:
A unique credentials token that can be returned to the client.
Throws:
WrappedException - Wraps exceptions that KeyMaster throws when it attempts to generate the token.

generateToken

public String generateToken(String userName,
                            Map<String,String> mappingData)
                     throws WrappedException

Generates a unique credentials token that the client can use to log in to Liberator.

The parameters passed to this method are signed and available as part of the token.

Liberator can be configured to use the mappingData passed to this method when it maps the subject requests of trade subscriptions. For example, if mappingData maps [“key”: “value”], and if Liberator is configured to map /FX/ to /FX/%{key}, Liberator will change all requests for the subject /FX/ to /FX/value. For further information about configuring Liberator, refer to the Liberator Administration Guide document.

Parameters:
userName - The username that is required to log in to Liberator.
mappingData - A map of key-value pairs. Each key in the map can only contain alphanumeric characters, the underscore, and the period (full stop) character.
Returns:
A unique credentials token that can be returned to the client.
Throws:
WrappedException - Wraps exceptions that KeyMaster throws when it attempts to generate the token.

generateToken

public String generateToken(String userName,
                            String extraDataToSign,
                            Map<String,String> mappingData)
                     throws WrappedException

Generates a unique credentials token that the client can use to log in to Liberator.

The parameters passed to this method are signed and available as part of the token.

Liberator can be configured to use the mappingData passed to this method when it maps the subject requests of trade subscriptions. For example, if mappingData maps [“key”: “value”], and if Liberator is configured to map /FX/ to /FX/%{key}, Liberator will change all requests for the subject /FX/ to /FX/value. For further information about configuring Liberator, refer to the Liberator Administration Guide document.

Parameters:
userName - The username that is required to log in to Liberator.
extraDataToSign - Extra data that will be signed and included in the token.
mappingData - A map of key-value pairs. Each key in the map can only contain alphanumeric characters, the underscore, and the period (full stop) character.
Returns:
A unique credentials token that can be returned to the client.
Throws:
WrappedException - Wraps exceptions that KeyMaster throws when it attempts to generate the token.


Please send bug reports and comments to Caplin support