I have the following sample method in my Repository (with @RepositoryRestResource annotation):
@Override @PreAuthorize("permitAll") @PostAuthorize("permitAll") public Iterable<User> findAll();
But I still get 401 Unauthorized , an event when I add these permitAll annotations to the entire repository interface.
I got this as my WebSecurityConfigurerAdapter :
@EnableWebSecurity @EnableGlobalMethodSecurity(prePostEnabled = true) @Configuration class WebSecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(final HttpSecurity http) throws Exception { http.authorizeRequests().anyRequest().fullyAuthenticated().and().httpBasic().and().csrf().disable(); } }
I believe that this takes precedence over these method annotations, boo, I don't know how to fix it.
spring spring-security
Pitel
source share