Skip to content

Spring Security roles issue

I overrode the method in the SpringWebConfig and I want to give all pages of application only for admins.

    protected void configure(HttpSecurity http) throws Exception {
                .antMatchers("/*", "/**").hasRole("ADMIN");

When I try to open page http://localhost:8080/api/v1/skills/ without any authorization I have a correct result instead of 403. Maybe I’m wrong with my config? Full project


Add the following class inside config package

package ua.wismut.config;


public class SecurityWebApplicationInitializer extends AbstractSecurityWebApplicationInitializer {