|
@@ -112,7 +112,7 @@ class CookieCsrfTokenRepositoryTests {
|
|
@Test
|
|
@Test
|
|
void saveTokenSecureFlagTrue() {
|
|
void saveTokenSecureFlagTrue() {
|
|
this.request.setSecure(false);
|
|
this.request.setSecure(false);
|
|
- this.repository.setCookieCustomizer((cookie)-> cookie.secure(Boolean.TRUE));
|
|
|
|
|
|
+ this.repository.setCookieCustomizer((cookie) -> cookie.secure(Boolean.TRUE));
|
|
CsrfToken token = this.repository.generateToken(this.request);
|
|
CsrfToken token = this.repository.generateToken(this.request);
|
|
this.repository.saveToken(token, this.request, this.response);
|
|
this.repository.saveToken(token, this.request, this.response);
|
|
Cookie tokenCookie = this.response.getCookie(CookieCsrfTokenRepository.DEFAULT_CSRF_COOKIE_NAME);
|
|
Cookie tokenCookie = this.response.getCookie(CookieCsrfTokenRepository.DEFAULT_CSRF_COOKIE_NAME);
|
|
@@ -132,7 +132,7 @@ class CookieCsrfTokenRepositoryTests {
|
|
@Test
|
|
@Test
|
|
void saveTokenSecureFlagFalse() {
|
|
void saveTokenSecureFlagFalse() {
|
|
this.request.setSecure(true);
|
|
this.request.setSecure(true);
|
|
- this.repository.setCookieCustomizer((cookie)-> cookie.secure(Boolean.FALSE));
|
|
|
|
|
|
+ this.repository.setCookieCustomizer((cookie) -> cookie.secure(Boolean.FALSE));
|
|
CsrfToken token = this.repository.generateToken(this.request);
|
|
CsrfToken token = this.repository.generateToken(this.request);
|
|
this.repository.saveToken(token, this.request, this.response);
|
|
this.repository.saveToken(token, this.request, this.response);
|
|
Cookie tokenCookie = this.response.getCookie(CookieCsrfTokenRepository.DEFAULT_CSRF_COOKIE_NAME);
|
|
Cookie tokenCookie = this.response.getCookie(CookieCsrfTokenRepository.DEFAULT_CSRF_COOKIE_NAME);
|
|
@@ -504,9 +504,4 @@ class CookieCsrfTokenRepositoryTests {
|
|
assertThatIllegalArgumentException().isThrownBy(() -> this.repository.setHeaderName(null));
|
|
assertThatIllegalArgumentException().isThrownBy(() -> this.repository.setHeaderName(null));
|
|
}
|
|
}
|
|
|
|
|
|
- @Test
|
|
|
|
- void setCookieMaxAgeZeroIllegalArgumentException() {
|
|
|
|
- assertThatIllegalArgumentException().isThrownBy(() -> this.repository.setCookieCustomizer((cookie) -> cookie.maxAge(0)));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
}
|
|
}
|