JAAS のスレッドの RunAs サブジェクトのオーバーライド

Java™ Authentication and Authorization Service (JAAS) のアプリケーション・プログラミング・インターフェース (API) で提供されている機能を拡張するには、RunAs サブジェクトまたは呼び出しサブジェクトに、この実行スレッド上のアウトバウンド要求に使用される別の有効なエントリーを設定します。

始める前に

これらの API を実行するには、以下の Java 2 セキュリティー権限が必要です。
  • permission javax.security.auth.AuthPermission "wssecurity.getRunAsSubject"
  • permission javax.security.auth.AuthPermission "wssecurity.getCallerSubject"
  • permission javax.security.auth.AuthPermission "wssecurity.setRunAsSubject"

このタスクについて

この拡張機能により、WSSubject.doAs メソッドを使用して サブジェクトをリモート・アクションに関連付けるかどうかにかかわらず、 このスレッド上のすべてのリモート呼び出しに対するサブジェクトの関連付けが柔軟に行えるようになります。

[z/OS]アプリケーション開発者は、WSSubject.doAs メソッドを使用して、JAAS サブジェクトを設定できます。このサブジェクトは、JAAS ログイン・モジュールによって、WebSphere® Application Server ランタイムが指定のアクションを実行する際に使用する、アクティブ・セキュリティー ID として認証されます。 WSSubject.doAs は、sync-to-thread に対して構成されたコンポーネント内で呼び出されたときのみスレッド ID と同期します。 アプリケーションの「Synch to OS Thread Allowed」オプションと併用する場合、 この ID は、そのアクションの有効範囲に対応するオペレーティング・システムのスレッド上に設定されます。

手順

  1. スレッドに新しい RunAs サブジェクトを設定し、宣言して設定したサブジェクトをオーバーライドします。
    com.ibm.websphere.security.auth.WSSubject.setRunAsSubject(caller_subject);  	 	 
  2. リモート呼び出しを実行します。
  3. 前の RunAs サブジェクトを復元します。
    com.ibm.websphere.security.auth.WSSubject.setRunAsSubject(runas_subject);

try { javax.security.auth.Subject runas_subject, caller_subject; runas_subject = com.ibm.websphere.security.auth.WSSubject.getRunAsSubject(); caller_subject = com.ibm.websphere.security.auth.WSSubject.getCallerSubject();   // set a new RunAs subject for the thread, overriding the one declaratively set com.ibm.websphere.security.auth.WSSubject.setRunAsSubject(caller_subject);   // do some remote calls   // restore back to the previous runAsSubject com.ibm.websphere.security.auth.WSSubject.setRunAsSubject(runas_subject); } catch (WSSecurityException e) { // log error } catch (Exception e) { // log error }


トピックのタイプを示すアイコン タスク・トピック



タイム・スタンプ・アイコン 最終更新: last_date
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=tsec_override
ファイル名:tsec_override.html