It's useless to set the context path of cookies to the web context.
Moreover, settings the web context in cookie's path will prevent rails to remove the cookie as it's only using '/'
private Cookie createCookie(@Nullable String csrfState, int timeoutInSeconds){
Cookie cookie = new Cookie(CSRF_STATE_COOKIE, csrfState);
- cookie.setPath(server.getContextPath() + "/");
+ cookie.setPath("/");
cookie.setSecure(server.isSecured());
cookie.setHttpOnly(false);
cookie.setMaxAge(timeoutInSeconds);
private Cookie createCookie(String name, @Nullable String value, int expirationInSeconds) {
Cookie cookie = new Cookie(name, value);
- cookie.setPath(server.getContextPath() + "/");
+ cookie.setPath("/");
cookie.setSecure(server.isSecured());
cookie.setHttpOnly(true);
cookie.setMaxAge(expirationInSeconds);
@Before
public void setUp() throws Exception {
- when(server.getContextPath()).thenReturn("");
when(request.getContextPath()).thenReturn("");
}
public void setUp() throws Exception {
when(system2.now()).thenReturn(NOW);
when(server.isSecured()).thenReturn(true);
- when(server.getContextPath()).thenReturn("");
when(request.getSession()).thenReturn(httpSession);
when(jwtSerializer.encode(any(JwtSerializer.JwtSession.class))).thenReturn(JWT_TOKEN);
when(jwtCsrfVerifier.generateState(eq(response), anyInt())).thenReturn(CSRF_STATE);