chain.doFilter(request, response); }
chain.doFilter(request, response);
    public void doFilter(ServletRequest request, ServletResponse response,        FilterChain chain) throws IOException, ServletException {        if (!(request instanceof HttpServletRequest)) {            throw new ServletException("Can only process HttpServletRequest");        }        if (!(response instanceof HttpServletResponse)) {            throw new ServletException("Can only process HttpServletResponse");        }        HttpServletRequest httpRequest = (HttpServletRequest) request;        HttpServletResponse httpResponse = (HttpServletResponse) response;        if (SecurityContextHolder.getContext().getAuthentication() == null) {            Authentication rememberMeAuth = rememberMeServices.autoLogin(httpRequest,                    httpResponse);            if (rememberMeAuth != null) {                // Attempt authenticaton via AuthenticationManager                try {                    authenticationManager.authenticate(rememberMeAuth);                } catch (AuthenticationException authenticationException) {                    if (logger.isDebugEnabled()) {                        logger.debug(                            "SecurityContextHolder not populated with remember-me token, as AuthenticationManager rejected Authentication returned by RememberMeServices: '"                            + rememberMeAuth                            + "'; invalidating remember-me token",                            authenticationException);                    }                    rememberMeServices.loginFail(httpRequest, httpResponse);                    chain.doFilter(request, response);                }                // Store to SecurityContextHolder                SecurityContextHolder.getContext()                                     .setAuthentication(rememberMeAuth);                if (logger.isDebugEnabled()) {                    logger.debug(                        "SecurityContextHolder populated with remember-me token: '"                        + SecurityContextHolder.getContext().getAuthentication()                        + "'");                }                // Fire event                if (this.eventPublisher != null) {                    eventPublisher.publishEvent(new InteractiveAuthenticationSuccessEvent(                            SecurityContextHolder.getContext()                                                 .getAuthentication(),                            this.getClass()));                }                chain.doFilter(request, response);            }        } else {            if (logger.isDebugEnabled()) {                logger.debug(                    "SecurityContextHolder not populated with remember-me token, as it already contained: '"                    + SecurityContextHolder.getContext().getAuthentication()                    + "'");            }            chain.doFilter(request, response);        }    }