Vaadin and CAS : how can I redirect the "/" route?

355 Views Asked by At

I am developing a single page app (vaadin 11 + CAS + Spring)

These urls are secured:

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

To log in I enter "localhost:8080/secured"

I want to redirect the "/" url so that if I call "localhost:8080" it redirects to "/secured"

To do so I add:

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

But now, when I call localhost:8080 I get 405 errors every 5 secondes:

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

I think this comes from vaadin engine...

How can I make this work ?

security conf:

@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);

}
0

There are 0 best solutions below