Hi All,
I took fediz-1.0.1 which was great since it included cxf2.6.2 and
wss4j-1.6.7.jar. I placed a filter behind FederationFiter try to access
claims from FederationPrincipal using following code. But it says that
Principle p is not an instance of FederationPrincipal. I didn't have this
problem from either Servlet or JSP. I am able to set security token using
SecurityTokenThreadLocal.getToken(), but as you know getting claims using
FederationPrincipal is much simpler. Could someone let me know why do I
have problem inside a Filter?
public void doFilter(ServletRequest servletRequest, ServletResponse
servletResponse,
FilterChain filterChain) throws IOException, ServletException {
// TODO Auto-generated method stub
// make sure we are dealing with HTTP
if (servletRequest instanceof HttpServletRequest) {
HttpServletRequest request = (HttpServletRequest)
servletRequest;
HttpServletResponse response = (HttpServletResponse)
servletResponse;
Principal p = request.getUserPrincipal();
System.out.println("Principal is not instance of
FederationPrincipal:" + p.getName());
if (p instanceof FederationPrincipal) {
FederationPrincipal fp = (FederationPrincipal)p;
ClaimCollection claims = fp.getClaims();
for (Claim c: claims) {
System.out.println(c.getClaimType().toString()
+ ": " + c.getValue());
}
} else {
System.out.println("Principal is not instance of
FederationPrincipal:" + p.getName());
}
Element el = SecurityTokenThreadLocal.getToken();
Thanks in advance.
Gina