if (this.context != null) { context.publishEvent(new InteractiveAuthenticationSuccesEvent( SecurityContextHolder.getContext().getAuthentication(), this.getClass()));
if (logger.isDebugEnabled()) { logger.debug( "Replaced SecurityContextHolder with remember-me token: '" + SecurityContextHolder.getContext().getAuthentication() + "'"); }   if (this.context != null) { context.publishEvent(new InteractiveAuthenticationSuccesEvent( SecurityContextHolder.getContext().getAuthentication(), this.getClass())); }
    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) {            SecurityContextHolder.getContext().setAuthentication(rememberMeServices                .autoLogin(httpRequest, httpResponse));            if (logger.isDebugEnabled()) {                logger.debug(                    "Replaced SecurityContextHolder with remember-me token: '"                    + SecurityContextHolder.getContext().getAuthentication()                    + "'");            }            // Fire event            if (this.context != null) {                context.publishEvent(new InteractiveAuthenticationSuccesEvent(                        SecurityContextHolder.getContext().getAuthentication(),                        this.getClass()));            }        } else {            if (logger.isDebugEnabled()) {                logger.debug(                    "SecurityContextHolder not replaced with remember-me token, as SecurityContextHolder already contained: '"                    + SecurityContextHolder.getContext().getAuthentication()                    + "'");            }        }        chain.doFilter(request, response);    }