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

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

例: デフォルトの許可トークンの使用

このトピックでは、WebSphere Application Server でデフォルトの許可トークンを使用する方法について 説明します。ダウンストリームに伝搬されるストリング属性を追加する場所を探している場合には、 デフォルトの許可トークンの使用を検討してみてください。

ただし、許可トークンに追加する属性が、 認証済みサブジェクトに関連付けられたユーザーに固有のものであることを確認してください。 ユーザーに固有のものではない場合、その属性はおそらく、 同様に要求により伝搬される伝搬トークンに属しています。伝搬トークンについて詳しくは、 例: デフォルトの伝搬トークンの使用 を参照してください。属性を許可トークンに追加するには、カスタム・ログイン・モジュールを、 構成済みの各種のシステム・ログイン・モジュールにプラグインする必要があります。 構成済みのインプリメンテーション com.ibm.ws.security.server.lm.wsMapDefaultInboundLoginModule を持つすべてのログイン・モジュール構成は、 伝搬済み情報を受信でき、別のサーバーへアウトバウンドに送信可能な伝搬情報を生成できます。

最初のログイン中に、伝搬済み属性がログイン構成に提示されない場合には、 ログインが ltpaLoginModule ログイン・モジュール内で行われた後、 デフォルトの許可トークンが wsMapDefaultInboundLoginModule ログイン・モジュール内に作成されます。 sharedState hashmap を使用して、 デフォルトの許可トークンへの参照を login メソッドから取得できます。 デフォルトの許可トークンを調べるには、 WebSphere Application Server への wsMapDefaultInboundLoginModule インプリメンテーションの後、 カスタム・ログイン・モジュールにプラグインする必要があります。

Java Authentication and Authorization Service (JAAS) プログラミング・モデルについて詳しくは、 セキュリティー: 学習用リソース を参照してください。

重要: カスタム・ログイン・モジュールを WebSphere Application Server ログイン・インフラストラクチャーに プラグインする場合は、そのたびに、コードがトラステッドであることを確認する必要があります。 ログイン・モジュールを app_server_root/classes ディレクトリーに追加すると、 ログイン・モジュールは Java 2 セキュリティーの AllPermissions 権限を持つことになります。 ログイン・モジュールおよび他のインフラストラクチャー・クラスは、 専用ディレクトリーに追加することを推奨します。 ただし、専用ディレクトリーを使用する場合は、 $(WAS_INSTALL_ROOT)/properties/server.policy ファイルを変更して、 専用ディレクトリー、Java アーカイブ (JAR) ファイル、またはその両方が、 ログイン・モジュールから呼び出されたアプリケーション・プログラミング・インターフェース (API) の実行に必要な許可を持つようにしてください。 ログイン・モジュールは、 呼び出しスタック上のアプリケーション・コードの後で実行される可能性もあるため、 アプリケーションで追加の許可が必要とならないように、 doPrivileged コード・ブロックを追加することも検討してください。
以下のサンプル・コ ードは、login メソッドからデフォルトの許可トークンへの参照を取得する方法、トークンに属性を追加する方法、 および許可用に使用される既存属性から読み取る方法を示しています。
public customLoginModule()
{
	public void initialize(Subject subject, CallbackHandler callbackHandler, 
          Map sharedState, Map options) 
	{
     	// (For more information on initialization, see
     //   システム・ログイン構成用のカスタム・ログイン・モジュール開発
.)

		// Get a reference to the sharedState map that is passed in during initialization.
	_sharedState = sharedState;
	}

public boolean login() throws LoginException 
	{
     	// (For more information on what to do during login, see
     //   システム・ログイン構成用のカスタム・ログイン・モジュール開発
.)

		// Look for the default AuthorizationToken in the shared state
		defaultAuthzToken  = (com.ibm.wsspi.security.token.AuthorizationToken) sharedState.get 
					(com.ibm.wsspi.security.auth.callback.Constants.WSAUTHZTOKEN_KEY);

		// Might not always have one of these generated. It depends on the login 
     // configuration setup.
		if (defaultAuthzToken != null)
		{
			try {
				// Add a custom attribute
				defaultAuthzToken.addAttribute("key1", "value1");

				// Determine all of the attributes and values that exist in the token.
				java.util.Enumeration listOfAttributes = defaultAuthorizationToken.
              getAttributeNames();
				
				while (listOfAttributes.hasMoreElements())
				{
					String key = (String) listOfAttributes.nextElement();

					String[] values = (String[]) defaultAuthorizationToken.getAttributes (key);

					for (int i=0;  i<values.length; i++)
					{
						System.out.println ("Key: " + key + ", Value[" + i + "]: " 
                  + values[i]);
					}
				}

				// Read the existing uniqueID attribute.
				String[] 	uniqueID = defaultAuthzToken.getAttributes 
						(com.ibm.wsspi.security.token.AttributeNameConstants.
               WSCREDENTIAL_UNIQUEID);

					// Getthe uniqueID from the String[]
					String unique_id = (uniqueID != null && 
                uniqueID[0] != null) ? uniqueID[0] : "";

				// Read the existing expiration attribute.
				String[] 	expiration = defaultAuthzToken.getAttributes 
						(com.ibm.wsspi.security.token.AttributeNameConstants.
               WSCREDENTIAL_EXPIRATION);

					// An example of getting a long expiration value from the string array.
					long expire_time = 0;
					if (expiration != null && expiration[0] != null) 
						expire_time = Long.parseLong(expiration[0]);

				// Read the existing display name attribute.
				String[] 	securityName = defaultAuthzToken.getAttributes 
						(com.ibm.wsspi.security.token.AttributeNameConstants.
               WSCREDENTIAL_SECURITYNAME);

					// Get the display name from the String[]
					String display_name = (securityName != null && 
                securityName[0] != null) ? securityName[0] : "";


				// Read the existing long securityName attribute.
				String[] 	longSecurityName = defaultAuthzToken.getAttributes 
					(com.ibm.wsspi.security.token.AttributeNameConstants.
             WSCREDENTIAL_LONGSECURITYNAME);

				// Get the long security name from the String[]
				String long_security_name = (longSecurityName != null && 
              longSecurityName[0] != null) ? longSecurityName[0] : "";


				// Read the existing group attribute.
				String[] 	groupList = defaultAuthzToken.getAttributes 
						(com.ibm.wsspi.security.token.AttributeNameConstants.
               WSCREDENTIAL_GROUPS);

				// Get the groups from the String[]
				ArrayList groups = new ArrayList();
				if (groupList != null)
				{
					for (int i=0; i<groupList.length; i++)
					{
						System.out.println ("group[" + i + "] = " + groupList[i]);
						groups.add(groupList[i]);
					}
				}
			}
catch (Exception e)
			{
		throw new WSLoginFailedException (e.getMessage(), e);
			}
		}

	}

public boolean commit() throws LoginException 
	{
		// (For more information on what to do during commit, see 
     //   システム・ログイン構成用のカスタム・ログイン・モジュール開発
.)

	}

	private java.util.Map _sharedState = null;
	private com.ibm.wsspi.security.token.AuthorizationToken defaultAuthzToken = null;
}
.

デフォルトの許可トークンに関連付けられている トークン・ファクトリーの変更

WebSphere Application Server がデフォルトの許可トークンを生成する場合、 アプリケーション・サーバーは、 com.ibm.wsspi.security.token.authorizationTokenFactory プロパティーを 使用して指定される TokenFactory クラスを使用します。管理コンソールを使用してこのプロパティーを変更するには、 以下のステップを実行します。
  1. セキュリティー」>「管理、アプリケーション、およびインフラストラクチャーの保護」をクリックします。
  2. 「追加プロパティー」の下の「カスタム・プロパティー」をクリックします。
com.ibm.ws.security.ltpa.AuthzPropTokenFactory トークン・ファクトリーが、 デフォルトです。このトークン・ファクトリーはデータをエンコードしますが、 許可トークンのデータの暗号化は行いません。許可トークンは通常、 Secure Sockets Layer (SSL) を使用して Common Secure Interoperability Version 2 (CSIv2) を流れるため、 そのトークンを暗号化する必要はありません。 ただし、許可トークンに対してそれ以上のセキュリティーが必要な場合は、暗号化を行うために、 別のトークン・ファクトリー・インプリメンテーションと、 このプロパティーを関連付けることができます。例えば、com.ibm.ws.security.ltpa.LTPAToken2Factory トークン・ファクトリーと このプロパティーを関連付けると、トークンは AES (Advanced Encryption Standard) 暗号化を使用します。ただし、セキュリティー・ニーズに対するパフォーマンスへの影響を評価する必要があります。 許可トークンに機密情報を追加することは、 トークン・ファクトリー・インプリメンテーションを、 ただエンコードするのではなく暗号化するものに変更する 1 つの理由となりま す。
デフォルトの許可トークンに対して独自の署名および暗号化を実行する場合は、 以下のクラスをインプリメントする必要があります。
  • com.ibm.wsspi.security.ltpa.Token
  • com.ibm.wsspi.security.ltpa.TokenFactory
トークン・ファクトリー・インプリメンテーションは、 トークン・インプリメンテーションをインスタンス化および検証します。 トークン・ファクトリーの initialize メソッドに渡される Lightweight Third Party Authentication (LTPA) 鍵を使用することも、 独自の鍵を使用することもできます。独自の鍵を使用する場合は、これらの鍵を使用して生成されるトークンを検証するために、 どの場所でも同じ鍵を使用する必要があります。 独自のカスタム・トークン・ファクトリーをインプリメントする方法について詳しくは、 インフォメーション・センターのフロントページのリンクから入手可能な API の資料を参照してください。 管理コンソールを使用してトークン・ファクトリーとデフォルトの許可トークンを関連付けるには、 以下のステップを実行します。
  1. セキュリティー」>「管理、アプリケーション、およびインフラストラクチャーの保護」をクリックします。
  2. 「追加プロパティー」の下の「カスタム・プロパティー」をクリックします。
  3. com.ibm.wsspi.security.token.authorizationTokenFactory プロパティーを探して、 このプロパティーの値がカスタム・トークン・ファクトリー・インプリメンテーションと一致することを確認します。
  4. 実装クラスが app_server_root/classes ディレクトリーに置かれていて、 WebSphere Application Server クラス・ローダーがそのクラスをロードできることを確認します。
  5. 実装クラスが ${USER_INSTALL_ROOT}/classes ディレクトリーに置かれていて、WebSphere Application Server クラス・ローダーがそのクラスをロードできることを確認します。



関連概念
セキュリティー属性の伝搬
関連タスク
アプリケーション・サーバー間のセキュリティー属性の伝搬
関連資料
例: デフォルトの伝搬トークンの使用
システム・ログイン構成用のカスタム・ログイン・モジュール開発
セキュリティー: 学習用リソース
参照トピック    

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

最終更新: Jan 21, 2008 7:44:53 PM EST
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.nd.doc/info/ae/ae/rsec_defauthtoken.html