我正在开发我的弹簧引导应用程序,它是受弹簧安全保护的。以下是安全配置的一部分:
@Override
public void configure(HttpSecurity http) throws Exception {
// @formatter:off
http
// .csrf().ignoringAntMatchers("/dashboard")
// .and()
.httpBasic()
.and()
.headers().frameOptions().disable()
.and()
.antMatcher("/**").authorizeRequests()
.antMatchers("/VAADIN/**", "/PUSH/**", "/UIDL/**").permitAll()
.antMatchers("/vaadinServlet/UIDL/**").permitAll()
.antMatchers("/vaadinServlet/HEARTBEAT/**").permitAll()
.antMatchers("/actuator/health").permitAll()
.antMatchers("/actuator/**").hasAuthority(Authority.Type.ROLE_ADMIN.getName())
.antMatchers("/", "/login**", "/index.html", "/home.html").permitAll()
.and()
.logout().logoutSuccessUrl("/").permitAll()
.and()
.csrf().csrfTokenRepository(csrfTokenRepository())
.and()
.addFilterAfter(csrfHeaderFilter(), CsrfFilter.class)
.addFilterBefore(ssoFilter(), BasicAuthenticationFilter.class);
// @formatter:on
}我将使用VAADIN实现一些管理仪表板来管理我的应用程序。我读过“在Spring或Vaadin中禁用CSRF保护。如果您都打开了,您的应用程序将无法工作.”。
在我的例子中,我需要禁用Vaadin中的CSRF保护,但是我无法找到如何使用Java配置来实现它。
现在我得到的是:https://127.0.0.1:8443/vaadinServlet/UIDL/?v-wsver=7.5.5&v-uiId=0 “通信错误:无法从服务器读取UIDL。请检查servlet映射。错误代码: 403",在从主视图导航到其他视图期间。(例如: /dashboard#!myview)这是因为调用了AccessDeniedHandlerImpl句柄方法。我尝试使用以下语句来修复这个问题,但这没有帮助:
.antMatchers("/vaadinServlet/UIDL/**").permitAll()
.antMatchers("/vaadinServlet/HEARTBEAT/**").permitAll()所以,请帮我解决这两个问题:
谢谢
发布于 2016-03-03 10:03:55
为了解决上述问题,我决定将我的项目分成两个模块。首先是API应用程序,它有自己实现的安全配置。第二个是仪表板,它基于这个Vaadin4Spring集成了Security和示例。
https://stackoverflow.com/questions/35636787
复制相似问题