[V5.1.1 and later]Trust association interceptor support for Subject creation

The new Trust Association Interceptor (TAI) interface, com.ibm.wsspi.security.tai.TrustAssociationInterceptor, supports several new features and is different from the existing com.ibm.websphere.security.TrustAssociationInterceptor interface. Although the existing interface is still supported, it is being deprecated in a future release.

The new TAI interface supports a multi-phase, negotiated authentication process. For example, some systems require a challenge response protocol back to the client. The two key methods in this new interface are:

Key method name

public boolean isTargetInterceptor (HttpServletRequest req)

The isTargetInterceptor method determines whether the request originated with the proxy server associated with the interceptor. The implementation code must examine the incoming request object and determine if the proxy server forwarding the request is a valid proxy server for this interceptor. The result of this method determines whether the interceptor processes the request.

Method result

A true value tells WebSphere Application Server to have the TAI handle the request.

A false value, tells WebSphere Application Server to ignore the TAI.

The negotiateValidateandEstablishTrust method determines whether to trust the proxy server from which the request originated. The implementation code must authenticate the proxy server. The authentication mechanism is proxy-server specific. For example, in the product implementation for the WebSEAL server, this method retrieves the basic authentication information from the HTTP header and validates the information against the user registry used by WebSphere Application Server. If the credentials are invalid, the code throws the WebTrustAssociationException, which indicates that the proxy server is not trusted and the request is denied. If the credentials are valid, the code returns a TAIResult, which indicates the status of the request processing along with the client identity (Subject and principal name) to be used for authorizing the Web resource.

Key method name

public TAIResult negotiateValidateandEstablishTrust (HttpServletRequest req, HttpServletResponse res)

Method result

Returns a TAIResult, which indicates the status of the request processing. The request object can be queried and the response object can be modified.

The TAIResult class has three static methods for creating a TAIResult. The TAIResult create methods take an int type as the first parameter. WebSphere Application Server expects the result to be a valid HTTP request return code and is interpreted in one of the following ways:

The created TAIResults have the following meanings:

TAIResult Explanation
public static TAIResult create(int status); Indicates a status to WebSphere Application Server. The status should not be SC_OK because the identity information is provided.
public static TAIResult create(int status, String principal); Indicates a status to WebSphere Application Server and provides the user ID or the unique ID for this user. WebSphere Application Server creates credentials by querying the user registry.
public static TAIResult create(int status, String principal, Subject subject); Indicates a status to WebSphere Application Server, the user ID or the unique ID for the user, and a custom Subject. If the Subject contains a Hashtable, the principal is ignored. The contents of the Subject becomes part of the eventual user Subject.


 

Example

The following code sample indicates that additional negotiation is required:

// Modify the HttpServletResponse object
	//  The response code is meaningful only on the client
	return TAIResult.create(HttpServletResponse.SC_CONTINUE);

The following code sample indicates that the TAI has determined the user identity. WebSphere Application Server receives the user ID only and then it queries the user registry for additional information:

// modify the HttpServletResponse object
	return TAIResult.create(HttpServletResponse.SC_OK, userid);

The following code sample indicates that the TAI had determined the user identity. WebSphere Application Server receives the complete user information that is contained in the Hashtable. For more information on the Hashtable, see Configuring inbound identity mapping. In this code sample, the Hashtable is placed in the public credential portion of the Subject:

// create Subject and place Hashtable in it
	Subject subject = new Subject;
	subject.getPublicCredentials().add(hashtable);
	//the response code is meaningful only the client
	return TAIResult.create(HttpServletResponse.SC_OK, "ignored", subject);

The following code sample indicates that there is an authentication failure. WebSphere Application Server fails the authentication request:

//log error message
	// ....
	throw new WebTrustAssociationFailedException("TAI failed for this reason");

There are a few additional methods on the TrustAssociationInterceptor interface that are discussed in the Java documentation. These methods are used for initialization, shut down, and for identifying the TAI to WebSphere Application Server.


Related tasks
Configuring WebSEAL or custom trust association interceptors
Configuring inbound identity mapping[V5.1.1 and later]