结合Vaadin Admin UI和REST API

发布于 2025-02-12 03:13:54 字数 366 浏览 3 评论 0原文

IM正在处理一个应该有两个部分的Spring Boot应用程序:在Vaadin中完成的一个admin UI-Part和一个由REST-API端点组成的部分,用于消费本机应用程序。

Admin UI(Form-Login)的身份验证应与REST API完全不同(例如,具有固定令牌或数据库的令牌)。

实现这一目标的最佳方法是什么?由于基本上是两个不同的应用程序,具有共同的数据访问是有意义的 /有可能两个启用两个弹簧应用程序上下文吗?还是足以以一种特殊的方式配置弹簧安全性?仅添加一个RestController并将Springsecurity的URL排除在外,已经将我带到了解决方案中的一半,但是如果我也想为REST-API进行身份验证该怎么办?但基本上与其自己的应用程序提供商完全不同。

Im working on an Spring Boot application which should have two parts: One Admin UI-Part done in Vaadin and one part consisting of REST-API Endpoints for a native application to consume.

Authentication of the Admin UI (Form-Login) should be completely different from the REST API (e.g. Basic Auth with a fixed token, or a token from the database).

What would be the best way to achive this? Since it's basically two different applications having the Data-access in common would it make sense / be possible two instanciate two spring application contexts? Or is it enough to configure spring security in a special way for example? Just adding a RestController and excluding the URL from SpringSecurity already brings me halfway to the solution, but what if I also want authentication for my REST-API? But completely different with its own application provider basically.

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

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

发布评论

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

评论(1

彼岸花ソ最美的依靠 2025-02-19 03:13:54

Spring支持基于角色的授权和多个身份验证提供商。因此,从本质上讲,您可以为您的管理用户提供特殊的角色,并在Vaadin视图中需要此角色,以防止普通用户访问Admin UI。您还可以在同一应用程序中具有单独的身份验证机制,例如,您可以通过LDAP对用户进行身份验证,并通过数据库进行管理。您不需要执行单独的应用程序上下文。

Spring supports role based authorization and multiple authentication providers. So essentially you can give you admin users a special role and require this role in your Vaadin views to prevent ordinary users accessing the admin UI. You can also have separate authentication mechanisms in the same application, for example you could have your users authenticated via LDAP and you admins via a database. You shouldn't need to do separate application contexts.

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