WebSphere Application Server API での LtpaToken2 Cookie を使用したダウンストリーム Web シングル・サインオンの実現
アプリケーションがユーザー・クレデンシャルを保管および送信する必要がない状態で、Lightweight Third Party Authentication (LTPA) Cookie のダウンストリーム・シングル・サインオン (SSO) Web 伝搬をプログラマチックに実行できます。
WebSphere® Application Server には、LtpaToken2 Cookie をダウンストリーム Web シングル・サインオン・アプリケーションに伝搬するための API サポートがあります。
中間層 WebSphere サーバーで実行される Web アプリケーションでは、LtpaToken2 Cookie をダウンストリーム Web 呼び出しに伝搬することが必要な場合があります。 このリリースの WebSphere Application Server には、アプリケーション開発者が、アプリケーションでユーザー・クレデンシャルを保管および送信することなく、ダウンストリーム SSO をプログラムで実行するための新しいアプリケーション・プログラミング・インターフェース (API) があります。
図 1. ダウンストリーム認証での LTPA Cookie API の使用

この機能は、パッケージ com.ibm.websphere.security.WSSecurityHelper のパブリック API であり、次のように定義されます。
/**
* Extracts an LTPA sso token from the subject of current
* thread and builds a ltpa cookie out of it for use on
* downstream web invocations.
* When the returned value is not null use Cookie methods
* getName() and getValue() to set the Cookie header
* on an http request with header value of
* Cookie.getName()=Cookie.getValue()
*
* @return an object of type javax.servlet.http.Cookie.
*
*/
新しい WSSecurityHelper API の使用法の以下に示します。
非推奨の機能 (Deprecated feature): WSSecurityHelper クラスの getLTPACookieFromSSOToken() メソッドは推奨されません。WebSecurityHelper クラスの getSSOCookieFromSSOToken() メソッドで提供される機能を使用します。depfeat
import javax.servlet.http.Cookie;
import com.ibm.websphere.security.WSSecurityHelper;
Cookie ltpaCookie = WSSecurityHelper.getLTPACookieFromSSOToken()

この後で、HTTP 要求ヘッダーで LTPA Cookie を設定できます。
この場合、Cookie ヘッダーの値は以下のストリングです。
ltpaCookie.getName()=ltpaCookie.getValue()
例えば org.apache.commons.httpclient.HttpMethod を使用して HTTP 要求を作成する場合、LTPA Cookie は次のように設定できます。
HttpMethod method = .; // new your HttpMethod based on the
// target URL for the web application
if (ltpaCookie != null)
method.setRequestHeader(“Cookie”, ltpaCookie.getName()+”=”+ltpaCookie.getValue());
注: LTPA Cookie は SSL 接続でのみ送信してください。
注: getter メソッドを発行する前に、上記の例の WSSecurityHelper.getLTPACookieFromSSOToken() 呼び出しから戻された LTPA Cookie が null でないかどうかを確認してください。また、LTPA Cookie オブジェクトを正常に取得し、実行スレッドに SSO トークンが存在するようにするには、ユーザーが中間層サーバーとの認証に成功していることを確認してください。
注: WebSphere Application
Server は、出荷時には HTTP プログラミングの JAR (Apache httpclient など) をサポートしていません。HTTP プログラミングのサポート機能を各自で用意する必要があります。