Spring security - endpoint only for admin
I would like to make "users" with the role "Administrator" accessible to endpoint "/admin/**", unfortunately no one has access to this API at this time. What am I doing wrong
@Configuration
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/api/login/").permitAll()
.antMatchers("/api/books/*").authenticated()
.antMatchers("/api/admin/**").hasAuthority("Administrator")
.and()
.addFilter(new JwtFilter(authenticationManager()))
.csrf().disable();
}
}