我正在尝试在Websphere Application Server上开发和部署自定义信任关联拦截器。做了以下步骤
找不到我在自定义拦截器的initialize方法中放入Sysout的任何日志,包括服务器启动/停止日志,sysout日志或跟踪日志。 无法确定错过哪种配置。 此外,在将其添加到拦截器列表时,是否需要在自定义拦截器类中添加任何自定义属性? 任何指针都会受到赞赏。
以下是自定义TAI代码
public class CustomSSOTAI implements TrustAssociationInterceptor {
private static final String CUSTOM_TAI_VERSION = "1.0.0";
private static final String CUSTOM_TAI_TYPE = "Custom Trust Association Interceptor";
@Override
public void cleanup() {
// TODO Auto-generated method stub
System.out.println("*****##### Custom SSO TAI - Inside cleanup Method #####*****");
}
@Override
public String getType() {
// TODO Auto-generated method stub
System.out.println("*****##### Custom SSO TAI - Inside getType Method #####*****");
return CUSTOM_TAI_TYPE;
}
@Override
public String getVersion() {
// TODO Auto-generated method stub
System.out.println("*****##### Custom SSO TAI - Inside getVersion Method #####*****");
return CUSTOM_TAI_VERSION;
}
@Override
public int initialize(Properties arg0) throws WebTrustAssociationFailedException {
// TODO Auto-generated method stub
System.out.println("*****##### Custom SSO TAI - Inside initialize Method #####*****");
System.out.println("*****##### Initializing Custom SSO TAI #####*****");
return 0;
}
@Override
public boolean isTargetInterceptor(HttpServletRequest arg0) throws WebTrustAssociationException {
// TODO Auto-generated method stub
System.out.println("*****##### Custom SSO TAI - Entering isTargetInterceptor Method #####*****");
System.out.println("Determining if this TAI should handle the incoming request...");
if (arg0.getParameter("callCustomInterceptor") != null) {
System.out.println("callCustomInterceptor: " + arg0.getParameter("callCustomInterceptor"));
System.out.println("Custom SSO TAI is being used to establish trust!");
return true;
}
System.out.println("Bypassing Custom SSO TAI, did not find a user ID in the request");
System.out.println("*****##### Custom SSO TAI - Exiting isTargetInterceptor Method #####*****");
return false;
}
@Override
public TAIResult negotiateValidateandEstablishTrust(HttpServletRequest arg0, HttpServletResponse arg1)
throws WebTrustAssociationFailedException {
// TODO Auto-generated method stub
System.out.println("*****##### Custom SSO TAI - Entering negotiateValidateandEstablishTrust Method #####*****");
String userId = arg0.getParameter("uid");
if (userId.equals("portalUser")) {
System.out.println("*********** CustomSSOTAI *****************");
System.out.println("UserID = " + userId);
return TAIResult.create(SipServletResponse.SC_OK, userId);
}
System.out.println("*****##### Custom SSO TAI - Exiting negotiateValidateandEstablishTrust Method #####*****");
return TAIResult.create(SipServletResponse.SC_FORBIDDEN, userId);
}
}
温暖的问候, Ekansh
答案 0 :(得分:0)
所有WAS版本(包括8.0.5)都支持TAI。你做的都是正确的,但只是为了确保:
com.company.CustomSSOTAI
Enable interceptros
,保存并重新启动。我知道你做到了; - )重新启动后,您应该在SystemOut.log
消息中看到有关其他TAI的消息(如果您没有删除它们)。检查一下,你的TAI已加载:
[9/22/17 13:58:11:885 CEST] 00000000 SystemOut O com.tivoli.pd.as.jacc.cfg.TAMConfigService initialize() About to initialize PDAdmin with the value C:\IBM\WebSphere\AppServer80\tivoli\tam
[9/22/17 13:58:11:947 CEST] 00000000 TrustAssociat A SECJ0121I: Trust Association Init class com.ibm.ws.security.web.TAMTrustAssociationInterceptorPlus loaded successfully
...
[9/22/17 13:58:11:963 CEST] 00000000 TrustAssociat A SECJ0121I: Trust Association Init class com.ibm.ws.security.spnego.TrustAssociationInterceptorImpl loaded successfully
...
[9/22/17 13:58:12:010 CEST] 00000000 TrustAssociat A SECJ0121I: Trust Association Init class gas.tai.CustomTAI loaded successfully
[9/22/17 13:58:12:010 CEST] 00000000 SystemOut O *****##### Custom SSO TAI - Inside initialize Method #####*****
[9/22/17 13:58:12:010 CEST] 00000000 SystemOut O *****##### Initializing Custom SSO TAI #####*****
[9/22/17 13:58:12:010 CEST] 00000000 TrustAssociat A SECJ0122I: Trust Association Init Interceptor signature: v1.0
[9/22/17 13:58:12:010 CEST] 00000000 distSecurityC I SECJ0240I: Security service initialization completed successfully
希望它有所帮助。