Use contextPath in One-Time-Token default submit UI

This commit is contained in:
Daniel Garnier-Moiroux
2024-09-06 11:23:29 +02:00
committed by Marcus Hert Da Coregio
parent ef31ae1a98
commit 528d739a60
2 changed files with 11 additions and 1 deletions

View File

@@ -77,6 +77,15 @@ class DefaultOneTimeTokenSubmitPageGeneratingFilterTests {
assertThat(response).contains("<form class=\"login-form\" action=\"/login/another\" method=\"post\">");
}
@Test
void setContextThenGenerates() throws Exception {
this.request.setContextPath("/context");
this.filter.setLoginProcessingUrl("/login/another");
this.filter.doFilterInternal(this.request, this.response, this.filterChain);
String response = this.response.getContentAsString();
assertThat(response).contains("<form class=\"login-form\" action=\"/context/login/another\" method=\"post\">");
}
@Test
void filterWhenTokenQueryParamUsesSpecialCharactersThenValueIsEscaped() throws Exception {
this.request.setParameter("token", "this<>!@#\"");