package com.pankaj.test;
import java.util.Properties;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.ibm.websphere.security.WebTrustAssociationException;
import com.ibm.websphere.security.WebTrustAssociationFailedException;
import com.ibm.wsspi.security.tai.TAIResult;
import com.ibm.wsspi.security.tai.TrustAssociationInterceptor;
public class PortalCustomTAI implements TrustAssociationInterceptor {
public void cleanup() {
//TODO ... Perform any cleanup here.
}
public String getType() {
return "Custom TAI ... " + this.getClass().getName();
}
public String getVersion() {
return "1.0";
}
public int initialize(Properties prop) throws WebTrustAssociationFailedException {
System.out.println("Portal Custom TAI Initialized ... ");
//TODO Perform any initialization operations here.
return 0;
}
public boolean isTargetInterceptor(HttpServletRequest req) throws WebTrustAssociationException {
System.out.println("Portal Custom TAI isTargetInterceptor ... sessionId : " + req.getRequestedSessionId());
boolean isTAIHandlingRequired = false;
// isTAIHandlingRequired = .... ; //Perform the appropriate operation here to check if this is the right TAI to invoke.
System.out.println("Portal Custom TAI isTargetInterceptor ... : " + isTAIHandlingRequired);
return isTAIHandlingRequired;
}
public TAIResult negotiateValidateandEstablishTrust(HttpServletRequest req, HttpServletResponse res) throws WebTrustAssociationFailedException {
TAIResult taiResult = null;
System.out.println("1. Portal Custom TAI negotiateValidateandEstablishTrust ... sessionId : " + req.getRequestedSessionId());
String userId = "testUser"; //Perform the appropriate operation here to obtain the user id which needs to be authenticated without password.
if(userId != null && !userId.trim().equals("")){
taiResult = TAIResult.create(HttpServletResponse.SC_OK, userId);
}
System.out.println("2. Portal Custom TAI negotiateValidateandEstablishTrust userId: " + userId);
return taiResult;
}
}
No comments:
Post a Comment