カスタム・インターセプター・インプリメンテーションでインプリメントされる以下のメソッドを構成する必要があります。
このリストにはメソッドのみが表示され、インプリメンテーションは含まれていません。
********************************************************************
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.
}
}
********************************************************************
注: init(Properties) メソッドをカスタム・インターセプターの以前の記述に従ってインプリメントした場合、この注意事項はインプリメンテーションに適用されません。次のステップに進んでください。
以前のバージョンの com.ibm.websphere.security.WebSphereBaseTrustAssociationInterceptor には、public int init (String propsfile) メソッドが含まれています。インターセプター・プロパティーはファイルから読み取られないため、このメソッドは不要です。
プロパティーは管理コンソールまたはスクリプトを使用して、インターセプターの管理コンソール「カスタム・プロパティー」リンクに入力されます。
これらのプロパティーは、init(Properties) メソッドでインプリメンテーションに使用できるようになります。
ただし、後方互換性を保つために、init(String) メソッドは引き続きサポートされています。
以下の例のように、init(String) メソッドは init(Properties) のデフォルト・インプリメンテーションで呼び出されます。
// 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 を値に連結して、プロパティーを含むファイルを取得します。
注:
init(Properties) メソッドをインプリメントする代わりに、init(String) メソッドを使用した場合でも、機能します。
唯一の要件は、カスタム・トラスト・アソシエーション・プロパティーを含むファイル名を、
管理コンソール内の、インターセプター用の「
カスタム・プロパティー」リンク
またはスクリプトを使用して入力することです。以下のメソッドの
いずれか を使用して、プロパティーを入力することができます。最初のメソッドは、
WebSphere Application Server の以前のバージョンとの後方互換性に使用されます。
- メソッド 1:
- 前のリリースで使用された、
同一のプロパティー名が、そのファイル名を取得するために使用されます。
そのファイル名は、com.ibm.websphere.security.trustassociation.types プロパティー値に
.config を連結することにより取得されます。
ファイル名が
myTAI.properties という名前で、
app_server_root/properties
ディレクトリーに配置されている場合、次のようにプロパティーを設定します。
- com.ibm.websphere.security.trustassociation.types = myTAItype
- com.ibm.websphere.security.trustassociation.myTAItype.config = app_server_root/properties/myTAI.properties
- メソッド 2:
- トラスト・アソシエーションのカスタム・プロパティーにある
com.ibm.websphere.security.trustassociation.initPropsFile プロパティーを、ファイルのロケーションに設定できます。
例えば、次のようにプロパティーを設定します。
これらの行は、1 つの連続した行として入力してください。