Spring security - endpoint only for admin
13:02 29 May 2020

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

    }
}
spring-boot security