1

我正在开发一个单页应用程序(vaadin 11 + CAS + Spring)

这些网址是安全的:

.regexMatchers("/secured.*").authenticated()

要登录,我输入“localhost:8080/secured”

我想重定向“/” url,这样如果我调用“localhost:8080”,它就会重定向到“/secured”

为此,我添加:

@GetMapping("/")
public String index() {
  return "redirect:secured";
}

但是现在,当我调用 localhost:8080 时,我每 5 秒就会收到 405 个错误:

Request URL: http://localhost:8080/?v-r=uidl&v-uiId=0
Request Method: POST
Status Code: 405 

我认为这来自vaadin引擎......

我怎样才能使这项工作?

安全配置:

@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf()
    .disable()
    .authorizeRequests()
    .regexMatchers("/secured.*")
    .authenticated()
    .and()
    .authorizeRequests()
    .regexMatchers("/")
    .permitAll()
    .and()
    .httpBasic()
    .authenticationEntryPoint(authenticationEntryPoint)
    .and()
    .addFilterBefore(singleSignOutFilter, CasAuthenticationFilter.class)
    .addFilterBefore(logoutFilter, LogoutFilter.class);

}
4

0 回答 0