当放置在其他模块中时,为什么Spring Security将401投掷?

发布于 2025-01-28 20:06:14 字数 1419 浏览 2 评论 0原文

我正在尝试根据 hexagonal Architecture 创建 Gradle多模块项目。

当前,执行./ gradlew -q projects

< img src =“ https://i.sstatic.net/vpfzu.png” alt =“在此处输入图像说明”>

除了 Spring Security 外,我的想法是将所有弹簧安全配置保持在不同的模块中。

但是,当将 WebSecurityConfiguration保留在不是的模块中 boot Module )中() /em>),它始终抛出 401

这是摘要:

  1. 当WebsecurityConfiguration类留在启动模块中时,它的工作方式就像魅力✅

  1. png“ rel =” nofollow noreferrer“>

”这不起作用...”

要牢记的事情:

  1. application.yaml可以选项1时的安全性。
  2. 由于该应用程序在选项1时可与Spring Security一起使用WebsecurityConfiguration代码。
  3. 在答案中,请参阅此线程和 comment 在答案时,我正在面对相同的问题 https://stackoverflow.com/a/58656278
  4. 所有模块 boot 均配置为jarenabled = jarenabled = true,因此它们不可引导。

任何帮助都将受到欢迎,因为我会为此疯狂。

I'm trying to create a Gradle multi-module project following the hexagonal architecture.

Currently, my project looks like this when executing ./gradlew -q projects:

enter image description here

All is working except for Spring Security, my idea was to keep all Spring Security configurations in a different module.

But when keeping the WebSecurityConfiguration in a module that is not the BOOT module (which is the one that contains the actual main class), it throws 401 always.

This is the summary:

  1. When WebSecurityConfiguration class stays in the BOOT module it works like a charm ✅

This works!

  1. When WebSecurityConfiguration is moved to a different module all rest calls to the controllers return 401 ❌

This doesn't work...

Things to keep in mind:

  1. Application.yaml is ok since the application works with spring security when option 1.
  2. WebSecurityConfiguration code is ok since the application works with spring security when option 1.
  3. See this thread and the comment on the answer, I'm facing the same problem https://stackoverflow.com/a/58656278
  4. All modules except BOOT are configured with jarEnabled = true, so they are not bootable.

Any help will be welcomed because I am going crazy with this. ????

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文