对于Vaadin 14,有一个文档清楚地说明了哪些Vaadin资源应该添加到配置中以绕过Spring Security:https://vaadin.com/docs/v14/flow/tutorial/login-and-authentication
/**
* Allows access to static resources, bypassing Spring Security.
*/
@Override
public void configure(WebSecurity web) {
web.ignoring().antMatchers(
// Client-side JS
"/VAADIN/**",
// the standard favicon URI
"/favicon.ico",
// the robots exclusion standard
"/robots.txt",
// web application manifest
"/manifest.webmanifest",
"/sw.js",
"/offline.html",
// icons and images
"/icons/**",
"/images/**",
"/styles/**",
// (development mode) H2 debugging console
"/h2-console/**");
}
我找不到Vaadin 24的相同信息。
这是我当前的配置:
@Override
public void configure(WebSecurity web) throws Exception {
super.configure(web);
web.ignoring().requestMatchers(
"/session-expired",
"/images/*",
"/login",
"/favicon.ico",
"/favicon-notification.ico",
"/offline.html",
"/offline-stub.html",
"/sw-runtime-resources-precache.js",
"/robots.txt");
}
为了使Vaadin 24正常运行,还需要添加什么?我需要在这里添加其他内容吗,例如:
"/VAADIN/**",
"/sw.js",
还是别的什么
2条答案
按热度按时间balp4ylt1#
您可以扩展为Vaadin应用程序设置所需规则的VaadinWebSecurity类。
https://vaadin.com/docs/latest/security/enabling-security/#security-configuration-class
如果由于某种原因无法扩展它,请查看代码以了解配置的内容。
gxwragnw2#
你应该用
AntPathRequestMatcher
对象 Package 你的路径。这是我对Vaadin 24 Flow的工作配置: