use of jakarta.servlet.http.Cookie in project spring-security by spring-projects.
the class SavedCookieMixinTests method serializeWithDefaultConfigurationTest.
// @formatter:on
@Test
public void serializeWithDefaultConfigurationTest() throws JsonProcessingException, JSONException {
SavedCookie savedCookie = new SavedCookie(new Cookie("SESSION", "123456789"));
String actualJson = this.mapper.writeValueAsString(savedCookie);
JSONAssert.assertEquals(COOKIE_JSON, actualJson, true);
}
use of jakarta.servlet.http.Cookie in project spring-security by spring-projects.
the class SavedCookieMixinTests method serializeSavedCookieWithList.
@Test
public void serializeSavedCookieWithList() throws JsonProcessingException, JSONException {
List<SavedCookie> savedCookies = new ArrayList<>();
savedCookies.add(new SavedCookie(new Cookie("SESSION", "123456789")));
String actualJson = this.mapper.writeValueAsString(savedCookies);
JSONAssert.assertEquals(COOKIES_JSON, actualJson, true);
}
use of jakarta.servlet.http.Cookie in project spring-security by spring-projects.
the class SavedCookieMixinTests method serializeWithOverrideConfigurationTest.
@Test
public void serializeWithOverrideConfigurationTest() throws JsonProcessingException, JSONException {
SavedCookie savedCookie = new SavedCookie(new Cookie("SESSION", "123456789"));
this.mapper.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.PUBLIC_ONLY).setVisibility(PropertyAccessor.GETTER, JsonAutoDetect.Visibility.ANY);
String actualJson = this.mapper.writeValueAsString(savedCookie);
JSONAssert.assertEquals(COOKIE_JSON, actualJson, true);
}
use of jakarta.servlet.http.Cookie in project spring-security by spring-projects.
the class FirewalledResponseTests method addCookieWhenCookieCommentContainsCrlfThenException.
@Test
public void addCookieWhenCookieCommentContainsCrlfThenException() {
Cookie cookie = new Cookie("foo", "bar");
cookie.setComment("foo\r\nbar");
assertThatIllegalArgumentException().isThrownBy(() -> this.fwResponse.addCookie(cookie)).withMessageContaining(CRLF_MESSAGE);
}
use of jakarta.servlet.http.Cookie in project spring-security by spring-projects.
the class FirewalledResponseTests method addCookieWhenCookiePathContainsCrlfThenException.
@Test
public void addCookieWhenCookiePathContainsCrlfThenException() {
Cookie cookie = new Cookie("foo", "bar");
cookie.setPath("/foo\r\nbar");
assertThatIllegalArgumentException().isThrownBy(() -> this.fwResponse.addCookie(cookie)).withMessageContaining(CRLF_MESSAGE);
}
Aggregations