我可以将敏感数据存储在 Quarkus 应用程序的 Vert.x 上下文中吗?
我正在寻找一个地方来存储一些请求范围的属性,例如使用 Quarkus 请求过滤器的用户 id。我稍后想在日志处理程序中检索这些属性并将它们放入 MDC 日志记录上下文中。
Vertx.currentContext()
是放置此类请求属性的正确位置吗?或者我在此上下文中设置的属性可以被其他请求读取吗?
如果这不是存储此类数据的正确位置,那么哪里才是正确的位置呢?
I am looking for a place to store some request scoped attributes such as user id using a Quarkus request filter. I later want to retrieve these attributes in a Log handler and put them in the MDC logging context.
Is Vertx.currentContext()
the right place to put such request attributes? Or can the properties I set on this context be read by other requests?
If this is not the right place to store such data, where would be the right place?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是...和否:-D
Vertx.currentContext()
可以提供两种类型的对象:在 Quarkus 2.7.2 中,我们做了很多工作来改进对重复上下文的支持。以前,它们仅用于 HTTP,现在用于 gRPC 和 @ConsumeEvent。 Quarkus 2.8 中将支持 Kafka 和 AMQP。
此外,在 Quarkus 2.7.2 中,我们引入了两个可能有用的新功能:
io.smallrye.common.vertx.ContextLocals
来访问上下文局部变量。这是一个简单的示例:
Yes ... and no :-D
Vertx.currentContext()
can provide two type of objects:In Quarkus 2.7.2, we have done a lot of work to improve our support of duplicated context. While before, they were only used for HTTP, they are now used for gRPC and @ConsumeEvent. Support for Kafka and AMQP is coming in Quarkus 2.8.
Also, in Quarkus 2.7.2, we introduced two new features that could be useful:
io.smallrye.common.vertx.ContextLocals
to access the context locals.Here is a simple example: