使用 resteasy 设置相同站点的 cookie 属性 [英] Setting the samesite cookie attrbute using resteasy
本文介绍了使用 resteasy 设置相同站点的 cookie 属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在做一个 quarkus 项目.我已经使用 RestEasy 构建了一个 REST API.我正在将 cookie 设置回此 API 的调用者,例如
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();
我想将 samesite 属性设置为 Strict.NewCookie 尚不支持此功能.Quarkus 有什么地方可以做到这一点.
I would like to set the samesite attribute as Strict. NewCookie doesnt yet support this. Is there some where to do this in Quarkus.
推荐答案
这是一个手动选项..
return Response.ok("Alice").header("Set-Cookie", "jwt="+newJwtCookie+"; SameSite=strict").build();
在 application.properties 中还有一个相关的标志 quarkus.http.same-site-cookie.jwt.value=Strict
.
there is also a related flag quarkus.http.same-site-cookie.jwt.value=Strict
in application.properties.
这篇关于使用 resteasy 设置相同站点的 cookie 属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文