+

Search Tips   |   Advanced Search

Implement a custom single sign-on token for security attribute propagation

Create our own single sign-on token implementation. The single sign-on token implementation is set in the login Subject and added to the HTTP response as an HTTP cookie.

The cookie name is the concatenation of the SingleSignonToken.getName API and the SingleSignonToken.getVersion API. There is no delimiter. When we add a single sign-on token to the Subject, it also gets propagated horizontally and downstream in case the Subject is used for other web requests. We must deserialize our custom single sign-on token when we receive it from a propagation login. Consider writing our own implementation to accomplish one of the following tasks:

To implement a custom single sign-on token:


Tasks

  1. Write a custom implementation of the SingleSignonToken interface.

    Many different methods are available for implementing the SingleSignonToken interface. However, make sure the methods required by the SingleSignonToken interface and the token interface are fully implemented.

    After you implement this interface, we can place it in the app_server_root/classes directory. Alternatively, we can place the class in any private directory. However, make sure that the WAS class loader can locate the class and that it is granted the appropriate permissions. We can add the Java archive (JAR) file or directory containing this class into the server.policy file so that it has the required permissions for the server code.

    (iSeries) After you implement this interface, we can place it in the profile_root/classes directory. For more information on classes, see Create a classes subdirectory in your profile for custom classes.

    Tip: All of the token types defined by the propagation framework have similar interfaces. Basically, the token types are marker interfaces that implement the com.ibm.wsspi.security.token.Token interface. This interface defines most of the methods. If we plan to implement more than one token type, consider creating an abstract class that implements the com.ibm.wsspi.security.token.Token interface. All of our token implementations, including the single sign-on token, might extend the abstract class and then most of the work is complete.

    To see an implementation of the single sign-on token, see Example: A com.ibm.wsspi.security.token.SingleSignonToken implementation

  2. Add and receive the custom single sign-on token during WAS logins. This task is typically accomplished by adding a custom login module to the various application and system login configurations. However, to deserialize the information, we must plug in a custom login module, which is discussed in a subsequent step. After the object is instantiated in the login module, we can add it to the Subject during the commit method.

    The code sample in Example: A custom single sign-on token login module, shows how to determine if the login is an initial login or a propagation login. The difference is whether the WSTokenHolderCallback callback contains propagation data. If the callback does not contain propagation data, initialize a new custom single sign-on token implementation and set it into the Subject. Also, look for the HTTP cookie from the HTTP request if the HTTP request object is available in the callback. We can get our custom single sign-on token both from a horizontal propagation login and from the HTTP request. However, IBM recommends that we make the token available in both places because then the information arrives at any front-end application server, even if that server does not support propagation.

    We can make your single sign-on token read-only in the commit phase of the login module. If we make the token read-only, additional attributes cannot be added within the applications.

    Restriction:

    • HTTP cookies have a size limitation. Size restrictions should be included in the documentation for our specific browser.

    • The WAS runtime does not handle cookies that it does not generate, so this cookie is not used by the runtime.

    • The SingleSignonToken object, when in the Subject, does affect the cache lookup of the Subject if you return something in the getUniqueID method.

  3. Get the HTTP cookie from the HTTP request object during login or from an application. The sample code found in Example: An HTTP cookie retrieval shows how we can retrieve the HTTP cookie from the HTTP request, decode the cookie so that it is back to your original bytes, and create our custom SingleSignonToken object from the bytes.

  4. Add our custom login module to WAS system login configurations that already contain the com.ibm.ws.security.server.lm.wsMapDefaultInboundLoginModule for receiving serialized versions of our custom propagation token. Because this login module relies on information in the sharedState state that is added by the com.ibm.ws.security.server.lm.wsMapDefaultInboundLoginModule login module, add this login module after the com.ibm.ws.security.server.lm.wsMapDefaultInboundLoginModule login module.

    For information on adding our custom login module into the existing login configurations, see Developing custom login modules for a system login configuration for JAAS.

After completing these steps, we have implemented a custom single sign-on token.


Subtopics


Related:

  • Security attribute propagation
  • Propagating security attributes among application servers
  • Developing custom login modules for a system login configuration for JAAS