Quarkus -Form Authentication的解密会话cookie

发布于 2025-01-25 05:10:48 字数 256 浏览 2 评论 0 原文

我想在Java Quarkus应用程序中阅读会话cookie。

根据此页面,,我们可以访问跨服务的信息。

我想使用它来管理同一用户的所有可能的会话,并添加一些信息,特别是用于WebSocket。

谢谢!

I'd like to read the session cookie in the java quarkus app.

According to this page https://quarkus.io/guides/security-built-in-authentication#form-auth, it's possible so we can get access to the information across services.

I'd like to use it to manage all possible sessions of the same user, and add some information, specially for websocket.

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

饮惑 2025-02-01 05:10:48

我猜您需要在端点上添加安全上下文,例如:

@GET
@Path("/")
public String getSubjectSecured(@Context SecurityContext sec) {
    Principal user = sec.getUserPrincipal();
    // Do stuff with user
}

请参阅 documentation

I'm guessing you need to add Security Context to endpoints, like this :

@GET
@Path("/")
public String getSubjectSecured(@Context SecurityContext sec) {
    Principal user = sec.getUserPrincipal();
    // Do stuff with user
}

See documentation

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文