dimanche 2 avril 2017

Spring Boot web security returns 404 Not Found after default login

I am not using any views in my case and my code looks like below:

protected void configure(HttpSecurity http) throws Exception {
  http
  .authorizeRequests()
  .antMatchers("/user/*").permitAll()
  .antMatchers("/admin/*").access("hasRole('ROLE_ADMIN')")
  .anyRequest().authenticated()
  .and()
  .formLogin();  

  http.csrf().disable();

 }

I just have one URL mapping in my Controller that would return me the list of all users ("/admin/getAllUsers")

However, when I try to access the admin URL, it gives me a login page, and when I enter the login credentials and press login, it gives me a 404 Not Found instead of the list of users.

What exactly am I missing here??




Aucun commentaire:

Enregistrer un commentaire