*/
@Test
public void testDoFilterHappyFlow() throws IOException, ServletException {
Map<String, String> attributes = new HashMap<String, String>();
attributes.put("key", "value");
VerifyTokenResponse recorderdResponse = new VerifyTokenResponse("org.surfnet.oaaas.conext.mock-client", Collections.singletonList("read"),
new AuthenticatedPrincipal("john.doe", Arrays.asList("user", "admin"), attributes), 0L);
MockFilterChain chain = doCallFilter(recorderdResponse);
/*
* Verify that the FilterChain#doFilter is called and the
* VerifyTokenResponse is set on the Request
*/
VerifyTokenResponse response = (VerifyTokenResponse) chain.getRequest().getAttribute(
AuthorizationServerFilter.VERIFY_TOKEN_RESPONSE);
assertEquals("value",response.getPrincipal().getAttributes().get("key"));
assertEquals("*", ((MockHttpServletResponse)chain.getResponse()).getHeader("Access-Control-Allow-Origin"));
/*
* Also test the cache by repeating the call and setting the expected result