结合Vaadin Admin UI和REST API
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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
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.