In a class who extends WebSecurityConfigurerAdapter I have this code to add security by url for different role.
http.authorizeRequests().antMatchers(HttpMethod.GET, "/rest/setup/defaultpassword/**").hasRole("USER");
http.authorizeRequests().antMatchers(HttpMethod.GET, "/rest/setup/commerces/**").hasRole("USER");
http.authorizeRequests().antMatchers(HttpMethod.GET, "/rest/setup/tax").hasRole("USER");
http.authorizeRequests().antMatchers("/rest/setup/tax").hasRole("ADMIN");
http.authorizeRequests().antMatchers("/login").permitAll(); //
http.authorizeRequests().antMatchers("/rest/**").authenticated();
http.csrf().disable();
http.exceptionHandling().authenticationEntryPoint(authenticationEntryPoint);
http.formLogin().successHandler(authenticationSuccessHandler);
http.formLogin().failureHandler(authenticationFailureHandler);
http.logout().logoutUrl("/logout");
http.logout().logoutSuccessUrl("/");
When I log with a user role, I can access: /rest/setup/tax
When I log with a admin role, I can access /rest/setup/tax
http://localhost:8080/rest/setup/tax 403 (Forbidden)
i search to provide only the get for user role and everything for admin one.