Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-3381

SameSite-Attribute in NewCookie is not serialized/deserialized

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 6.2.6.Final, 7.0.0.Alpha1
    • 6.2.5.Final
    • Core
    • None

      The following test fails with RestEasy:

      @Test
      public void testCookie_Serialization() {
          var newCookie = new NewCookie.Builder("testcookie")
                  .value("hello")
                  .path("/")
                  .version(1)
                  .maxAge(-1)
                  .secure(true)
                  .httpOnly(true)
                  .sameSite(NewCookie.SameSite.STRICT)
                  .build();
      
          String serializedCookie = RuntimeDelegate.getInstance().createHeaderDelegate(NewCookie.class).toString(newCookie);
          assertTrue(String.format("serialized cookie does not contain samesite-attribute: %s", serializedCookie), serializedCookie.toLowerCase().contains("samesite=strict"));
      } 

      The error message shows that the same-site attribute is not correctly serialized:

      StrictTest.testCookie_Serialization:43 serialized cookie does not contain samesite-attribute: testcookie=hello;Version=1;Path=/;Secure;HttpOnly
      

              jperkins-rhn James Perkins
              frankeichfelder Frank Eichfelder (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: