Setting the samesite cookie attrbute using resteasy

1.7k views Asked by At

I am working on a quarkus project. I have built a REST API using RestEasy. I am setting a cookie back to the caller of this API like

return Response.ok("Alice").cookie(new NewCookie("jwt", newJwtCookie)).build(); 

I would like to set the samesite attribute as Strict. NewCookie doesnt yet support this. Is there some where to do this in Quarkus.

1

There are 1 answers

1
Haroon On BEST ANSWER

this is a manual option..

return Response.ok("Alice").header("Set-Cookie", "jwt="+newJwtCookie+"; SameSite=strict").build();

there is also a related flag quarkus.http.same-site-cookie.jwt.value=Strict in application.properties.