Allow all URLs but one in Spring security

If you’re using Java Configuration, you can use something like following in your configure method:

@Override
protected void configure(HttpSecurity http) throws Exception {
    http
            .authorizeRequests()
                .antMatchers("/employee/me").authenticated()
                .antMatchers("/**").permitAll();
}

Leave a Comment