Example usage for org.apache.shiro.util ThreadContext remove

List of usage examples for org.apache.shiro.util ThreadContext remove

Introduction

In this page you can find the example usage for org.apache.shiro.util ThreadContext remove.

Prototype

public static Object remove(Object key) 

Source Link

Document

Unbinds the value for the given key from the current thread.

Usage

From source file:org.codice.ddf.catalog.plugin.clientinfo.ClientInfoPluginTest.java

License:Open Source License

@After
public void cleanup() throws Exception {
    ThreadContext.remove(CLIENT_INFO_KEY);
}

From source file:org.codice.ddf.catalog.plugin.clientinfo.ClientInfoPluginTest.java

License:Open Source License

@Test
public void testNoClientInfoDoesNothing() throws Exception {
    ThreadContext.remove(CLIENT_INFO_KEY);
    prepareMockOperation(mockCreateRequest);
    plugin.processPreCreate(mockCreateRequest);
    assertThat(properties.get(CLIENT_INFO_KEY), nullValue());
}

From source file:org.codice.ddf.pax.web.jetty.ClientInfoFilter.java

License:Open Source License

@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
        throws IOException, ServletException {
    ThreadContext.put(CLIENT_INFO_KEY, createClientInfoMap(servletRequest));
    try {//from  w ww. ja  v a 2  s  .c om
        filterChain.doFilter(servletRequest, servletResponse);
    } finally {
        ThreadContext.remove(CLIENT_INFO_KEY);
    }
}

From source file:org.graylog2.security.ShiroSecurityContext.java

License:Open Source License

public void loginSubject() throws AuthenticationException {
    // what a hack :(
    ThreadContext.put("REQUEST_HEADERS", headers);
    subject.login(token);// w ww. j a v  a 2 s .com
    // the subject instance will change to include the session
    final Subject newSubject = ThreadContext.getSubject();
    if (newSubject != null) {
        subject = newSubject;
    }
    ThreadContext.remove("REQUEST_HEADERS");
}