Skip to content

Commit e5e962e

Browse files
committed
Jakarta Cookie HttpOnly Serialization
The new specification represents Cookie attribute using HttpOnly: "" vs HttpOnly: "true". This updates the test to correspond to the new Servlet specification and is a breaking change related to jakarta updates.
1 parent 0e2d864 commit e5e962e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

web/src/main/java/org/springframework/security/web/jackson2/CookieDeserializer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public Cookie deserialize(JsonParser jp, DeserializationContext ctxt) throws IOE
5252
cookie.setVersion(readJsonNode(jsonNode, "version").asInt());
5353
cookie.setPath(readJsonNode(jsonNode, "path").asText());
5454
JsonNode attributes = readJsonNode(jsonNode, "attributes");
55-
cookie.setHttpOnly(readJsonNode(attributes, "HttpOnly").asBoolean());
55+
cookie.setHttpOnly(readJsonNode(attributes, "HttpOnly") != null);
5656
return cookie;
5757
}
5858

web/src/test/java/org/springframework/security/web/jackson2/CookieMixinTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public class CookieMixinTests extends AbstractMixinTests {
5252
" \"@class\": \"jakarta.servlet.http.Cookie\"," +
5353
" \"name\": \"demo\"," +
5454
" \"value\": \"cookie1\"," +
55-
" \"attributes\":{\"@class\":\"java.util.Collections$UnmodifiableMap\", \"HttpOnly\": \"true\"}," +
55+
" \"attributes\":{\"@class\":\"java.util.Collections$UnmodifiableMap\", \"HttpOnly\": \"\"}," +
5656
" \"comment\": null," +
5757
" \"maxAge\": -1," +
5858
" \"path\": null," +

0 commit comments

Comments
 (0)