org.systinet.wasp.security.ws
Class UsernameToken

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

public class UsernameToken
extends SecurityToken

Represents WS-Security username token.

Example

 // create service client instance
 ServiceClient serviceClient = ServiceClient.create("http://...");

 // authenticate client and set the credentials
 Credentials creds = WaspSecurity.acquireClientCredentials("Chris", "sirhC", "WS-Security");
 WaspSecurity.setCredentials(serviceClient, new Credentials[]{creds});
 WaspSecurity.setInitiatingProvider(serviceClient, "WS-Security");

 // create service proxy
 ServiceSoap svc = (ServiceSoap) serviceClient.createProxy(ServiceSoap.class);

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

 // create username token (password will be sent in plaintext)
 UsernameToken usernameToken = new UsernameToken(PasswordOption.TEXT);

 // add username token to message security
 ms.addToken(usernameToken);

 // set call security configuration
 ms.setCallSecurity(serviceClient);

 // invoke service method
 svc.ping("EchoString");
 

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

Field Summary
 
Fields inherited from class org.systinet.wasp.security.ws.SecurityToken
NULL_PROPERTY_CONF_ARRAY
 
Constructor Summary
UsernameToken(PasswordOption passwordOption)
          Initializes the token with current user credentials.
UsernameToken(java.lang.String alias, java.lang.String password, PasswordOption passwordOption)
          Initializes the token with current user credentials.
 
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.
 void setNoNonceAndCreated()
          Disables Nonce and Created subelements.
 
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

UsernameToken

public UsernameToken(PasswordOption passwordOption)
Initializes the token with current user credentials.

Parameters:
passwordOption - password type

UsernameToken

public UsernameToken(java.lang.String alias,
                     java.lang.String password,
                     PasswordOption passwordOption)
Initializes the token with current user credentials.

Parameters:
alias - the username element value
passwordOption - password type
Method Detail

setNoNonceAndCreated

public void setNoNonceAndCreated()
Disables Nonce and Created subelements.


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
Returns:
Constants.STM_REFERENCE

getSignatureMethodHint

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

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

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:
null