Vaadin 22与春季MVC和春季安全

发布于 2025-02-03 21:43:14 字数 1782 浏览 4 评论 0原文

我正在尝试获得一个基本的VAADIN22应用程序,该应用程序运行带有Spring MVC和Spring Security。 vaadin docs 似乎暗示了这一点可能,

如果应用程序是基于Spring引导的,则可以使用一组注释和最低弹簧安全配置来启用此机制。但是,也可以在不基于Spring Boot的Vaadin Spring应用程序中使用它,并带有一些额外的配置。

我从 skeleton-starter-starter-flow v22 a href =“ https://github.com/smillied/skeleton--starter-flow” rel =“ nofollow noreferrer”>此处并添加了基本的春季集成(请参阅在这里)。然后,我尝试添加弹簧安全性。

我最初扩展了Vaadin的VaadinwebsecurityConfigurerAdapter(请参阅),但是当我跑步时由于缺少自动依赖关系,因此该应用程序失败了。

接下来,我强​​迫一些组件进行扫描来检测缺失的依赖关系(请参阅),但是现在有一个classNotFoundException,因为对弹簧引导类有一个依赖性,ServletRegistrationBean

最终,我放弃了Vaadin的VaadinwebsecurityConfigurerAdapter,而是扩展了Spring的spring ewsecurityConfigurerAdapter(请参阅-Starter-Flow/commit/EC535F25B5E215291DCBD32AB92A965D1DB720C7“ rel =“ nofollow noreferrer”>在这里)。现在,该应用程序运行,但是我没有看到默认情况下应该提供的默认登录屏幕。

任何帮助都非常感谢。

注意:可以使用该应用程序运行,

mvn jetty:run

I am trying to get a basic Vaadin22 app running with Spring MVC and Spring Security. The vaadin docs seem to allude that this is possible,

If an application is based on Spring Boot, this mechanism can be enabled by using a set of annotations and with minimum Spring Security configurations. However, it is also possible to use it in Vaadin Spring applications that are not based on Spring Boot, with some extra configurations.

I have started with skeleton-starter-flow v22, forked to here and added basic Spring integration (see here). I have then attempted to add Spring Security.

I initially extended Vaadin's VaadinWebSecurityConfigurerAdapter (see here), but when I run the app it fails because there are missing autowired dependencies.

Next, I forced some component scanning to detect the missing dependencies (see here), but now there is a ClassNotFoundException because there is a dependency on the Spring Boot class, ServletRegistrationBean

Finally, I abandoned Vaadin's VaadinWebSecurityConfigurerAdapter and instead extended Spring's WebSecurityConfigurerAdapter (see here). Now the app runs, but I am not seeing the default login screen that Spring is supposed to provide by default.

Any assistance greatly appreciated.

Note: The app can be run using,

mvn jetty:run

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

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

发布评论

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

评论(1

旧伤还要旧人安 2025-02-10 21:43:14

因此,似乎Vaadin的VaadinwebsecurityConfigurerAdapter旨在与Spring Boot一起使用(我要避免使用)。为了使基本的春季安全性工作,我改用Spring的WebsecurityConfigurerAdapter,但是我缺少Spring AbstractSecuritywebapplicationInitializer的实现,该级别会记录适当的安全过滤器。参见

这样做的问题是,我不会得到vaadin的“ nofollow noreferrer”>基于查看的访问控制。为了获得此功能,我需要从VaadinwebsecurityConfigurerAdapter开始使用/迁移功能。

So it seems that Vaadin's VaadinWebSecurityConfigurerAdapter is intended for use with Spring Boot (which I'm trying to avoid). In order to get basic Spring Security working, I extended Spring's WebSecurityConfigurerAdapter instead, but I was missing an implementation of Spring's AbstractSecurityWebApplicationInitializer which registers the appropriate security filter. See here for the working solution.

The problem with this, is that I will not get Vaadin's View-Based Access Control. In order to get this, I will need to start using/migrating functionality from VaadinWebSecurityConfigurerAdapter.

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