Example usage for org.springframework.security.core.context SecurityContextImpl SecurityContextImpl

List of usage examples for org.springframework.security.core.context SecurityContextImpl SecurityContextImpl

Introduction

In this page you can find the example usage for org.springframework.security.core.context SecurityContextImpl SecurityContextImpl.

Prototype

public SecurityContextImpl() 

Source Link

Usage

From source file:org.unitedinternet.cosmo.acegisecurity.providers.ticket.TicketAuthenticationClearingFilter.java

/**
 * Detects if a ticket is associated with
 * the current context and clears the context.
 * @param request The servlet request./*from  w  ww. jav  a 2s .  c  om*/
 * @param response The servlet response.
 * @param chain The filter chain.
 * @throws IOException - if something is wrong this exception is thrown.
 * @throws ServletException - if something is wrong this exception is thrown.
 */
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
        throws IOException, ServletException {

    SecurityContext sc = SecurityContextHolder.getContext();
    if (sc.getAuthentication() != null && sc.getAuthentication() instanceof TicketAuthenticationToken) {
        if (LOG.isDebugEnabled()) {
            LOG.debug("found ticket authentication clearing...");
        }
        SecurityContextHolder.setContext(new SecurityContextImpl());
    }

    chain.doFilter(request, response);
}