How i can enable Spring security for some routes. For examle:
i have web site with content by different routes which started from
'/**'
. In this routes i need disable spring security.
But i have another web module
/admin-panel/**
where i must enable spring security.
So, my security config
@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/*").permitAll()
.antMatchers("/admin-panel").permitAll()
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.permitAll()
.and()
.logout()
.permitAll();
}