org.systinet.wasp.security.ws
Class X509Token

java.lang.Object
  extended byorg.systinet.wasp.security.ws.ReferrableElement
      extended byorg.systinet.wasp.security.ws.SecurityToken
          extended byorg.systinet.wasp.security.ws.X509Token

public class X509Token
extends SecurityToken

Represents WS-Security X.509 token.

See Signature and EncryptedData for examples.

Note that in order to be able to receive messages which contain data encrypted with callee public key, corresponding instance of X509Token has to be added to external (context) tokens, for example:

 // create X509 token with current credentials
 X509Token token = new X509Token();

 // create context security configuration
 MessageSecurity ms = new MessageSecurity();

 // add the token to external tokens in context security configuration
 ms.addExternalToken(token);

 // set context security configuration
 ms.setContextSecurity(...); // ServiceClient or ServiceEndpoint instance
 

Since:
4.6
See Also:
UsernameToken, SharedSecretToken
Component:
Security-Providers

Field Summary
 
Fields inherited from class org.systinet.wasp.security.ws.SecurityToken
NULL_PROPERTY_CONF_ARRAY
 
Constructor Summary
X509Token()
          Initializes a new X509 token with current user credentials.
X509Token(java.lang.String alias)
          Initializes a new X509 token with the specified alias.
X509Token(java.lang.String alias, java.lang.String password)
          Initializes a new X509 token with the specified alias and password.
 
Method Summary
protected  java.lang.String getEncryptionMethodHint()
          Returns encryption method hint.
protected  java.lang.String getKeyEncryptionMethodHint()
          Returns key encryption method hint.
protected  SecurityTokenConf getSecurityTokenConf(MessageConf messageConf)
          Creates low-level API token configuration.
protected  java.lang.String getSignatureMethodHint()
          Returns signature method hint.
protected  java.lang.String getTokenReferenceModeHint(SecurityElement securityElement)
          Returns token reference mode hint.
 
Methods inherited from class org.systinet.wasp.security.ws.SecurityToken
getExternalTokenReferenceModeHint
 
Methods inherited from class org.systinet.wasp.security.ws.ReferrableElement
getId, getIdForced, setId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

X509Token

public X509Token()
Initializes a new X509 token with current user credentials.


X509Token

public X509Token(java.lang.String alias)
Initializes a new X509 token with the specified alias. A typical usecase is getting a token for encrypting message for the receiver - alias should point to remote identity entry in WSO2 SOA Enablement Server keystore.

If alias is null, token is initialized with received credentials. This is useful for response encryption with requestor's public key. It is equivalent to setting the value to "..." (turnkey alias) in low-level or persistent configuration. See MessageSecurity for more information.

Parameters:
alias - keystore alias or null for received credentials token initialization

X509Token

public X509Token(java.lang.String alias,
                 java.lang.String password)
Initializes a new X509 token with the specified alias and password. A typical usecase is signing message with the key stored in the key store under the given alias which can be decrypted using the given password. If contains the X09 certificate if it is added to the message.

Parameters:
alias - a keystore alias
password - password which decrypts the private key
Method Detail

getSecurityTokenConf

protected SecurityTokenConf getSecurityTokenConf(MessageConf messageConf)
Creates low-level API token configuration.

Specified by:
getSecurityTokenConf in class SecurityToken
Returns:
token configuration

getTokenReferenceModeHint

protected java.lang.String getTokenReferenceModeHint(SecurityElement securityElement)
Returns token reference mode hint.

Specified by:
getTokenReferenceModeHint in class SecurityToken
Parameters:
securityElement - security element
Returns:
Constants.STM_REFERENCE if securityElement is instance of Signature or Constants.STM_KEYIDENTIFIER if securityElement is instance of EncryptedData

getSignatureMethodHint

protected java.lang.String getSignatureMethodHint()
Returns signature method hint.

Specified by:
getSignatureMethodHint in class SecurityToken
Returns:
Constants.ALGO_ID_SIGNATURE_RSA

getEncryptionMethodHint

protected java.lang.String getEncryptionMethodHint()
Returns encryption method hint.

Specified by:
getEncryptionMethodHint in class SecurityToken
Returns:
Constants.ALGO_ID_BLOCKCIPHER_TRIPLEDES

getKeyEncryptionMethodHint

protected java.lang.String getKeyEncryptionMethodHint()
Returns key encryption method hint.

Specified by:
getKeyEncryptionMethodHint in class SecurityToken
Returns:
Constants.ALGO_ID_KEYTRANSPORT_RSA15