Build Forge SSO フレームワークは、多くの市販の SSO ソリューションとの 統合を可能にする機能を提供します。SSO フレームワークはインターセプター・ベース であり、HTTP 要求をインターセプトして、それを処理するためのメソッドを提供します。 カスタム・インターセプターを作成し、HTTP 要求に含まれるセキュリティー成果物を 受信したり検証したりすることができます。具体的には、インターセプターによって HTTP 応答にトークンを設定し、そのトークンを後続の要求内で探すことができます。
Build Forge では、以下の 2 つの SSO ソリューションを提供します。
com.buildforge.services.server.sso.ISSOIntercaptor
これは、以下のサービス層コンポーネントに配置されています。<bfinstall>/Apache/tomcat/webapps/rbf-services/WEB-INF/classes
インターフェースは以下のようなメソッドを提供します。
インターセプターの構成は、
で定義します。 Build Forge には、以下の構成が組み込まれています。インターセプター・クラスをインプリメントして、Build Forge Apache Tomcat アプリケーション・サーバー に配置した後、ここで新規 SSO 構成を構成します。このクラスは、 SSO 構成の 1 プロパティーです。
このリストの配列は、インターセプターが要求処理の打診を受ける 順序を決定します。複数のインターセプターを構成し、要求を処理する ことができます。ログインの間に、各インターセプターは順次打診を受けます。 要求内の属性に適した属性を持っているインターセプターで、最初にアクティブになっているものが要求を処理します。1 つの要求は、単独のインターセプター で処理します。これは常に、isTargetInterceptor に 対して最初に true を返したインターセプターです。
Build Forge にカスタム・インターセプターを作成する手順は、以下のとおりです。
このクラスには、ISSOInterceptor インターフェースをインプリメントする必要があります。
<bfinstall>/Apache/tomcat/webapps/rbf-services/WEB-INF/classes
要求の間、アクティブな SSO 構成は、パネルに表示されている順序で アクセスを受けます。ユーザーの構成は、デフォルトでアクティブになっており、アクセス時に必ず true を返すため、フォーム SSO 構成の前に配置する必要があります。SPNEGO SSO 構成は、 デフォルトでは非アクティブです。
以下は、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 のインプリメンテーションの間に、 結果を返す前の応答状況を以下のように設定する必要があります。
responseAttributes.setStatus(HttpServletResponse.SC_OK);
responseAttributes.setStatus(HttpServletResponse,SC_FORBIDDEN);
responseAttributes.setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY);
responseAttributes.sendRedirecct(url);
使用可能な状況値はその他にもあります。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;