I'm learnig spring security and I came across this piece of code from https://spring.io/guides/tutorials/spring-boot-oauth2/
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.antMatcher("/**")
.authorizeRequests()
.antMatchers("/", "/login**", "/webjars/**", "/error**")
.permitAll()
.anyRequest()
.authenticated();
}
I removed .antMatcher("/**")
and the code is still working.
I understand **
matches zero or more directories in a path, So I thought antMatcher("/**").authorizeRequestes().antMatcher("/login")
would match "/login"
that is directly or indirectly under root path, ie I expected it match paths like /login
and /demo/login
but that's not the case, It matches only /login
that's directly underneath the root path.
So what exactly is the need for .antMatcher("/**") here
?