FilterChain chain) throws IOException, ServletException {
if (request instanceof HttpServletRequest) {
HttpServletRequest hrequest = (HttpServletRequest)request;
Principal p = hrequest.getUserPrincipal();
FederationPrincipal fedPrinc = (FederationPrincipal)p;
Element el = (Element)fedPrinc.getLoginToken();
if (el != null) {
try {
SecurityTokenThreadLocal.setToken(el);
chain.doFilter(request, response);
} finally {