带有 resteasy-reactive 和 Quarkus 的 SameSite cookie

问题描述

我在尝试使用 resteasy-reactive 在 Quarkus 中设置 SameSite 属性时遇到了困难。

我有这样的资源:

RECGAD_AU

该服务有一个方法来创建将在 AFTER INSERT OR UPDATE

中使用的 NewCookie 对象
@Blocking
@Path("/authentication")
public class AuthenticationResource {

    @Path("/login")
    @POST
    public Response login(....) {

        LoginResponse loginResponse = authenticationService.login(...);
        
        return Response.ok(response)
                .cookie(response.getRefreshTokenCookie())
                .build();
    }
}

也在 application.yaml 中写了这些配置

AuthenticationResource

但我无法进行测试, NewCookie buildresponseCookie(String refreshToken) { return new NewCookie( "refresh",// cookie name refreshToken,// cookie value "/",// path appDomain,// domain 1,// version "",// comment refreshCookieExpSeconds,// max age DateUtils.NowPlusSeconds(refreshCookieExpSeconds),// expires !environment.isLocal(),// secure (https) true); // http only } 属性始终为空

quarkus:
  http:
    same-site-cookie:
      "refresh":
        value: Strict

我发现的解决方法 (Setting the samesite cookie attrbute using resteasy),它是在这样的标题中强制 SameSite,但它看起来太丑了

SameSite

而且我认为 application.yaml 中的“相同站点 cookie”配置不适用于 JaxRS cookie (https://github.com/quarkusio/quarkus/pull/9288)

这个问题有优雅的解决方案吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)