use of org.codice.ddf.security.handler.cas.filter.ProxyFilterChain in project ddf by codice.
the class CasHandlerTest method testNoPrincipalResolve.
/**
* Tests that the handler properly returns a REDIRECTED result if the assertion is not in the
* session and resolve is true.
*
* @throws ServletException
* @throws IOException
*/
@Test
public void testNoPrincipalResolve() throws ServletException, IOException {
CasHandler handler = createHandler();
Filter testFilter = mock(Filter.class);
handler.setProxyFilter(new ProxyFilter(Arrays.asList(testFilter)));
HandlerResult result = handler.getNormalizedToken(createServletRequest(false), mock(HttpServletResponse.class), new ProxyFilterChain(null), true);
assertEquals(HandlerResult.Status.REDIRECTED, result.getStatus());
// verify that the filter was called once
verify(testFilter).doFilter(any(ServletRequest.class), any(ServletResponse.class), any(FilterChain.class));
}
Aggregations