WebSphere Application Server Network Deployment, Version 6.0.x   
             オペレーティング・システム: AIX , HP-UX, Linux, Solaris, Windows

             目次と検索結果のパーソナライズ化

例: スレッドからの呼び出し元サブジェクトの取得

呼び出し元サブジェクト (または「受信サブジェクト」) には、 この要求への呼び出しで使用されるユーザー認証情報が含まれます。このサブジェクトは、 既存のオブジェクトが置き換えられないように、WSSubject.getCallerSubject アプリケーション・プログラミング・インターフェース (API) の 発行後に戻されます。このサブジェクトは読み取り専用とマークされています。この API を使用すると、 WSCredential クレデンシャルにアクセスできるので、クレデンシャル内の hashmap にデータを書き込んだり設定したり することができます。

サブジェクト内のほとんどのデータは、別のサーバーへのダウンストリームに伝搬されません。 WSCredential クレデンシャル内のクレデンシャル・トークンのみがダウンストリームに伝搬され、 新規の呼び出し元サブジェクトが生成されます。

try
{
javax.security.auth.Subject caller_subject;
com.ibm.websphere.security.cred.WSCredential caller_cred;

caller_subject = com.ibm.websphere.security.auth.WSSubject.getCallerSubject();

if (caller_subject != null)
{
caller_cred = caller_subject.getPublicCredentials(com.ibm.websphere.security.cred.WSCredential.class).iterator().next();
String CALLERDATA = (String) caller_cred.get ("MYKEY");
System.out.println("My data from the Caller credential is:  " + CALLERDATA);
}
}
catch (WSSecurityException e)
{
// log error
}
catch (Exception e)
{
// log error
}

要件: この API を実行するには、次のような Java 2 セキュリティー権限が必要です。 permission javax.security.auth.AuthPermission "wssecurity.getCallerSubject;"




関連タスク
Java Authentication and Authorization Service によるアプリケーション・ログインの カスタマイズ
関連資料
サーバー・サイドの Java Authentication and Authorization Service の認証およびログイン構成のカスタマイズ
参照トピック    

ご利用条件 | フィードバック

最終更新: Jan 21, 2008 10:13:28 PM EST
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r0/index.jsp?topic=/com.ibm.websphere.nd.doc/info/ae/ae/rsec_getcaller.html