use of org.springframework.mock.web.MockCookie in project cas by apereo.
the class CookieRetrievingCookieGeneratorTests method verifyCookieSameSiteLax.
@Test
public void verifyCookieSameSiteLax() {
val ctx = getCookieGenerationContext();
ctx.setSameSitePolicy("lax");
val gen = new CookieRetrievingCookieGenerator(ctx);
val context = new MockRequestContext();
val request = new MockHttpServletRequest();
val response = new MockHttpServletResponse();
context.setExternalContext(new ServletExternalContext(new MockServletContext(), request, response));
gen.addCookie(request, response, false, "CAS-Cookie-Value");
val cookie = (MockCookie) response.getCookie(ctx.getName());
assertNotNull(cookie);
assertEquals("Lax", cookie.getSameSite());
}
Aggregations