シングル・サインオン・フレームワークについて

Build Forge SSO フレームワークは、多くの市販の SSO ソリューションとの 統合を可能にする機能を提供します。SSO フレームワークはインターセプター・ベース であり、HTTP 要求をインターセプトして、それを処理するためのメソッドを提供します。 カスタム・インターセプターを作成し、HTTP 要求に含まれるセキュリティー成果物を 受信したり検証したりすることができます。具体的には、インターセプターによって HTTP 応答にトークンを設定し、そのトークンを後続の要求内で探すことができます。

Build Forge では、以下の 2 つの SSO ソリューションを提供します。

SSO フレームワーク・メソッド

SSO インターセプターは、Build Forge SSO フレームワークが使用する インターフェースをインプリメントした、以下のような Java クラスです。
com.buildforge.services.server.sso.ISSOIntercaptor
これは、以下のサービス層コンポーネントに配置されています。
<bfinstall>/Apache/tomcat/webapps/rbf-services/WEB-INF/classes

インターフェースは以下のようなメソッドを提供します。

initInterceptor
インターセプターのロード時に呼び出されます。構成プロパティーのマップは、 initInterceptor() メソッドに渡されます。 構成プロパティーは、Build Forge コンソールの「管理」 > 「セキュリティー」 > 「SSO」で作成します。
isTargetInterceptor
インバウンド要求の属性を確認し、このインターセプターがそれらの属性に対処する必要があるかどうかを判別します。対処が必要な場合、インターセプターは authenticateRequest() メソッドで要求を認証します。対処が不要な場合、このインターセプターはスキップされます。 インターセプターの選択では、実行中に複数のインターセプターが構成されることを 想定しています。これらは順次対処されます。
authenticateRequest
要求内のデータを使用して、要求を認証します。応答属性を使用して、 データをクライアントに返送します。
logoutRequest
要求の処理後に、ユーザー関連のセキュリティー情報をすべてクリーンアップします。

インターセプターの構成および配列

インターセプターの構成は、「管理」 > 「セキュリティー」 > 「SSO」で定義します。 Build Forge には、以下の構成が組み込まれています。

インターセプター・クラスをインプリメントして、Build Forge Apache Tomcat アプリケーション・サーバー に配置した後、ここで新規 SSO 構成を構成します。このクラスは、 SSO 構成の 1 プロパティーです。

このリストの配列は、インターセプターが要求処理の打診を受ける 順序を決定します。複数のインターセプターを構成し、要求を処理する ことができます。ログインの間に、各インターセプターは順次打診を受けます。 要求内の属性に適した属性を持っているインターセプターで、最初にアクティブになっているものが要求を処理します。1 つの要求は、単独のインターセプター で処理します。これは常に、isTargetInterceptor に 対して最初に true を返したインターセプターです。

注: フォーム SSO インターセプターは、エラー発生時にフォールバックを提供できるように、アクティブな状態にしておく必要があります。 リストでは、フォーム SSO インターセプターの前にカスタム・インターセプター を配置する必要があります。

カスタム SSO インターセプターの追加

Build Forge にカスタム・インターセプターを作成する手順は、以下のとおりです。

  1. カスタム Java クラスを作成します。

    このクラスには、ISSOInterceptor インターフェースをインプリメントする必要があります。

  2. 作成したカスタム・クラスを、サービス層コンポーネント WAR にデプロイします。
    1. コンパイル済みのカスタム SSO インターセプター・クラスを含む JAR ファイルを作成します。
    2. 作成した JAR ファイルを Build Forge サービス層コンポーネントの以下のロケーションにコピーします。
      <bfinstall>/Apache/tomcat/webapps/rbf-services/WEB-INF/classes
    3. このディレクトリー内で JAR ファイルを unzip します。SSOManager により、 ここにロードするクラスが検索されます。
    4. Build Forge を再始動します。
  3. オプション: 環境変数を定義します。この環境変数は、プロパティー・オブジェクトとして initInterceptor() メソッドに渡すことができます。
    1. 管理コンソールで、「環境変数」に移動します。
    2. 「環境変数の追加」をクリックします。
    3. SSO インターセプターを初期化するために必要なプロパティーをすべて定義します。
  4. SSO インターセプターを Build Forge に追加します。
    1. 管理コンソールで、「管理」 > 「セキュリティー」 > 「SSO」と移動します。
    2. 「SSO 構成の追加」をクリックします。そのプロパティーを以下のように指定します。
      • 「名前」- SSO 構成の名前を入力します。
      • 「アクティブ」-「はい」に設定します。認証要求の間に、 すべてのアクティブな構成はアクセスを受けます。アクセスを受ける順序は、パネルに表示される順序と同じです。
      • 「Java クラス」- クラスの完全なパッケージ名を入力します。 所定のクラスは、1 つの SSO インターセプターにのみ割り当てることができます。
      • 「環境変数」- この SSO インターセプターで使用する環境変数を定義した場合には、その環境変数を選択します。
    3. 「保存」をクリックします。
    追加した SSO インターセプターがリストに表示されるはずです。
  5. SSO 構成を配列します。SSO インターセプターの左側にあるアイコンをクリックして、「最上部に移動」を選択します。

    要求の間、アクティブな SSO 構成は、パネルに表示されている順序で アクセスを受けます。ユーザーの構成は、デフォルトでアクティブになっており、アクセス時に必ず true を返すため、フォーム SSO 構成の前に配置する必要があります。SPNEGO SSO 構成は、 デフォルトでは非アクティブです。

authenticateRequest インプリメンテーションの例

以下は、WebSphere SSO Interceptor を使用して、WebSphere セキュリティーを Build Forge に統合した例です。

このインターセプターは、リフレクションを使用して WebSphere クラス WSSubject を検出します。 このクラスには、AuthServlet へのログインに使用するプリンシパルを返す、 getCallerPrincipal メソッドがあります。 AuthServlet は、WAS が認証に使用する前に保護する必要があります。

さらに多くの情報を返すことができる、その他のメソッドが使用可能です。 任意のアプリケーション・サーバーで動作可能な、同様のメソッドが使用可能です。

public Result authenticateRequest 
      (Request requestAttributes, Response responseAttributes) 
       throws SSOException {

  Result result = null;

try {
  Class<?> cl = 
    Class.forName(“com.ibm.websphere.security.auth.WSSubject”);
      Method theMethod = cl.getMethod("getCallerPrincipal", 
        (Class[])null);
    String principal = (String)theMethod.invoke((Object[])null, 
          (Object[])null);

if (principal != null 
      && principal.length() > 0 
      && !principal.equals("UNAUTHENTICATED")) {
  result = new Result(Result.UseridOnlyOID, domain, principal);
	responseAttributes.setStatus(HttpServletResponse.SC_OK);	
} catch (Exception e) {
		throw new SSOException(e);
}

return result;
}

authenticateRequest のインプリメンテーションの間に、 結果を返す前の応答状況を以下のように設定する必要があります。

使用可能な状況値はその他にもあります。HttpServletResponse に関する JavaDoc を参照してください。

ログイン・エラーからのリカバリー

カスタム・インターセプターがテスト時に正しく動作しない場合、 最も問題がある可能性が高いのは認証です。この場合、以下の情報を示す エラー・ページが表示されます。

Build Forge エラー

     Buil Forge コンソールへのアクセスが拒否されました

     "Error authenticating:
     com.buildforge.services.common.api.APIException - API:
     Authentication Error."

     同じタイプのログインを再試行する場合は、ここをクリックするか、
     強制的にフォーム・ログイン (ユーザー ID/パスワード) を実行する場合は
     ここをクリックしてください。

リカバリーには以下の 2 つのオプションがあります。

メソッド・ソースのリスト

以下のコメントおよびソースのリストは、ISSOInterceptor インターフェース内のメソッドに関する詳細情報を提供します。

initInterceptor
	/**
	 * This method is called when the interceptor is loaded.  A map of the 
     configuration properties is passed into the init method.  You can create 
     the configuration properties from a BuildForge Environment and associate 
     it with the SSO configuration.
	 *
	 * @param initializationProps used to configure the implementation
	 * @return true if successful, false if an error should be reported.
	 * @throws SSOException if the initialization fails
	 **/
	public boolean initInterceptor (Properties initializationProps) throws SSOException; 
isTargetInterceptor

	/**
	 * This methods will review the attributes in the requestAttributes Map 
     to determine if there is something that this interceptor should 
     act on.  If the interceptor return is "true", then the interceptor will 
     be responsible for authenticating the request and the authenticateRequest 
     method is invoked.   If the interceptor return is "false", then this 
     interceptor is skipped and the next isTargetInterceptor in the list will 
     be called.  Ordering of the interceptors during the configuration will 
     return which interceptor has the first shot at authenticating a request.
	 *
	 * @param requestAttributes attributes found in the inbound request	 
   * @return true if this interceptor will authenticate the request, 
             false if it will not.
	 * @throws SSOException
	 *
	 **/
	public boolean isTargetInterceptor(Request requestAttributes) throws SSOException;
	authenticateRequest

  /**
	 * This method is called on an interceptor that returns true for the 
     isTargetInterceptor method.  The Request will contain data used 
     to perform the authentication.  The Response is for the interceptor 
     to send information back to the client.  The Result returned will contain 
     the following information if the status code is 200:
	 * 
	 * OID:  an object identifier of the SecurityContext that can process token 
     information stored in this map when going to an Agent.
	 * Domain:  a valid BF domain name or <default> if not known 
     (the username must be valid in the configured realm).
	 * Username:  a valid BF username.   This will be used to lookup BFUser attributes 
     that are used in checking authorization policy.
	 * @see com.buildforge.services.common.security.context.Result
	 * 
	 * @param requestAttributes attributes found in the inbound request
	 * @param responseAttributes sent back in the outbound response
	 * @return com.buildforge.services.common.security.context.Result - result 
          information that tells BF how to handle the authentication request.
	 * @throws com.buildforge.services.server.sso.SSOException
	 **/
	public Result authenticateRequest(
			Request requestAttributes, 
			Response responseAttributes)
		throws SSOException;
	logoutRequest

  /**
	 * This method is called to logout a request.  The first interceptor that 
     returns true for the isTargetInterceptor method will perform the logout.   
     The main point is to clean up any user-related security information that 
     should not be kept.  The interceptor can inspect the request and response 
     objects to determine what needs to be removed.
	 * 
	 * @param requestAttributes attributes found in the inbound request
	 * @param responseAttributes sent back in the outbound response
	 * @return boolean - true if request redirect to exit page, 
                       false if redirect to login page.
	 * @throws com.buildforge.services.server.sso.SSOException
	 **/
	public boolean logoutRequest(
			Request requestAttributes, 
			Response responseAttributes)
		throws SSOException;

フィードバック