[Version 6 only]WebSphere Application Server - Express, Version 6.0.x     Operating Systems: AIX, HP-UX, Linux, Solaris, Windows

Retrieving tokens from the JAAS Subject in a client application

Why and when to perform this task

In WebSphere Application Server Version 6.0.x, the security handlers are responsible for propagating security tokens. These security tokens are embedded in the Simple Object Access Protocol (SOAP) security header and passed to downstream servers. The security tokens are encapsulated in the implementation classes for the com.ibm.wsspi.wssecurity.auth.token.Token interface. You can retrieve the security token data from either a server application or a client application.

With a client application, the application serves as the request generator and the response consumer and runs as the Java 2 Platform, Enterprise Edition (J2EE) client application. The consumer component for Web services security stores the security tokens that it receives in one of the properties of the MessageContext object for the current Web services call. You can retrieve a set of token objects through the javax.xml.rpc.Stub interface of that Web Services call. You must know which security tokens to retrieve and their token IDs in case multiple security tokens are included in the SOAP security header. Complete the following steps to retrieve the security token data from a client application:

Steps for this task

  1. Use the com.ibm.wsspi.wssecurity.token.tokenPropergation key string to obtain the Hashtable for the tokens through a property value in the javax.xml.rpc.Stub interface. The following example shows how to obtain the Hashtable:
    java.util.Hashtable t;
    javax.xml.rpc.Service serv = …;
    MyWSPortType pt = (MyWSPortType)serv.getPort(MyWSPortType.class);
    t = (Hashtable)((javax.xml.rpc.Stub)pt)._getProperty( 
    com.ibm.wsspi.wssecurity.Constants.WSSECURITY_TOKEN_PROPERGATION);
  2. Search the targeting token objects in the Hashtable. Each token object in the Hashtable is set with its token ID as a key. You must have prior knowledge of the security token IDs to retrieve the security tokens. The following example shows how to retrieve a username token from the security header with a certain token ID value:
    com.ibm.wsspi.wssecurity.auth.token.UsernameToken unt;
    if (t != null) {
      unt = (com.ibm.wsspi.wssecuty.auth.token.UsernameToken)t.get(“…”);
    }
    

Result

After completing these steps, you have retrieved the security tokens from the JAAS Subject in a client application



Related concepts
Security token

Related tasks
Configuring Java 2 security
Configuring Java 2 security policy files
Securing Web services for version 6.0.x applications based on WS-Security

Task topic    

Terms of Use | Feedback

Last updated: Jun 8, 2005 12:45:23 PM EDT
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r0/index.jsp?topic=/com.ibm.websphere.express.doc/info/exp/ae/twbs_retrievetokencl.html

© Copyright IBM Corporation 2004, 2005. All Rights Reserved.
This information center is powered by Eclipse technology. (http://www.eclipse.org)