use of org.codice.ddf.security.handler.cas.filter.ProxyFilter in project ddf by codice.
the class CasHandlerTest method createHandler.
private CasHandler createHandler() {
CasHandler handler = new CasHandler();
STSClientConfiguration clientConfiguration = mock(STSClientConfiguration.class);
when(clientConfiguration.getAddress()).thenReturn(STS_ADDRESS);
handler.setClientConfiguration(clientConfiguration);
Filter testFilter = mock(Filter.class);
handler.setProxyFilter(new ProxyFilter(Arrays.asList(testFilter)));
return handler;
}
use of org.codice.ddf.security.handler.cas.filter.ProxyFilter 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