使用するインターセプター・クラス・メソッドを定義することができます。 WebSphere Application Server は、 com.ibm.websphere.security.TrustAssociationInterceptor および com.ibm.wsspi.security.tai.TrustAssociationInterceptor の 2 つのトラスト・アソシエーション・インターセプター・インターフェースをサポートします。
isTargetInterceptor メソッドは、要求がインターセプターと関連付けられた プロキシー・サーバーから発信されているかどうかを判断します。インプリメンテーション・コードは、着信要求オブジェクトを検査して、 要求を転送しているプロキシー・サーバーがこのインターセプターにとって有効なプロキシー・サーバーであるかどうかを判別しなければなりません。 このメソッドの結果によって、インターセプターが要求を処理するかどうかが決まります。
validateEstablishedTrust メソッドは、要求を発信したプロキシー・サーバーが信頼できるかどうかを判断します。 このメソッドは、 isTargetInterceptor メソッドのあとに呼び出されます。インプリメンテーション・コードは、プロキシー・サーバーを認証しなければなりません。 この認証メカニズムは、プロキシー・サーバー特有のものです。 例えば、WebSeal サーバー用の製品インプリメンテーションでは、 このメソッドは、基本認証情報を HTTP ヘッダーから取得し、WebSphere Application Server が 使用するユーザー・レジストリーと 照らし合わせてこの情報の妥当性を検査します。クレデンシャルが無効な場合、コードは WebTrustAssociationException を作成して、プロキシー・サーバーを信頼せず、要求を拒否することを示します。
getAuthenticatedUsername メソッドは、プロキシー・サーバーと WebSphere Application Server 間に信頼を確立した後に呼び出されます。製品は要求のプロキシー・サーバー認証を受け入れているため、ここで要求を許可する必要があります。 要求を許可するには、発信元リクエスターの名前を許可ポリシーに送信して、リクエスターに必須の特権があるかどうかを判別します。 このメソッドのインプリメンテーション・コードは HTTP 要求ヘッダーからユーザー名を抽出して、要求されたリソースに対する権限がユーザーにあるかどうかを判別する必要があります。 例えば、WebSEAL サーバーの製品インプリメンテーションの場合、このメソッドは HTTP 要求ヘッダー内で iv-user 属性を検索し、関連する ユーザー ID を抽出して許可します。
以下のリストの適用度
******************************************************************** import java.util.*; import javax.servlet.http.HttpServletRequest; import com.ibm.websphere.security.*; public class myTAIImpl extends WebSphereBaseTrustAssociationInterceptor implements TrustAssociationInterceptor { public myTAIImpl () { } public boolean isTargetInterceptor (HttpServletRequest req) creates WebTrustAssociationException { //return true if this is the target interceptor, else return false. } public void validateEstablishedTrust (HttpServletRequest req) creates WebTrustAssociationFailedException { //validate if the request is from the trusted proxy server. //throw exception if the request is not from the trusted server. } public String getAuthenticatedUsername (HttpServletRequest req) creates WebTrustAssociationUserException { //Get the user name from the request and if the user is //entitled to the requested resource //return the user. Otherwise, throw the exception } public int init (Properties props) { //initialize the implementation. If successful return 0, else return -1. } public void cleanup () { //Cleanup code. } } ********************************************************************
// Default implementation of init(Properties props) method. A Custom // implementation should override this. public int init (java.util.Properties props) { String type = props.getProperty("com.ibm.websphere.security.trustassociation.types"); String classfile= props.getProperty("com.ibm.websphere.security.trustassociation." +type+".config"); if (classfile != null && classfile.length() > 0 ) { return init(classfile); } else { return -1; } }
init(String propsfile) メソッドではなく、init(Properties) メソッドを インプリメントするようにインプリメンテーションを変更します。上記の例のように、このデフォルト・インプリメンテーションはプロパティーを読み取って、プロパティー・ファイルをロードします。 com.ibm.websphere.security.trustassociation.types プロパティーは .config を値に連結して、プロパティーを含むファイルを取得します。
com.ibm.websphere.security.trustassociation.initPropsFile= app_server_root/properties/myTAI.properties
これらの行は、1 つの連続した行として入力してください。
プロパティー・ファイルの場所は完全に修飾します (app_server_root/properties/myTAI.properties など)。Network Deployment 環境で場所が異なる可能性があるため、${USER_INSTALL_ROOT} などの変数を使用して、WebSphere Application Server のインストール・ディレクトリーを参照します。例えば、ファイル名が myTAI.properties で app_server_root/properties ディレクトリーに配置されている場合は、次のようにプロパティーを設定します。
このファイルは各ノードのクラス・パスおよび各セルのクラス・パスにコピーする必要があります。