原创

How to create Authentication object inside the @RabbitListener methods?

温馨提示:
本文最后更新于 2024年04月12日,已超过 47 天没有更新。若文章内的图片失效(无法正常加载),请留言反馈或直接联系我

In my application there is a listener that operates with methods requiring Authentication from Spring Security and request information. Unfortunately, those methods do not have their authentication tokens during runtime and the requests are not bound to any thread so when RabbitMQ tries to send those requests the exception is thrown:

No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
正文到此结束
热门推荐
本文目录