401 Response after calling "/"
legshort opened this issue · comments
OAuth2ServerConfiguration.java
@Override
public void configure(HttpSecurity http) throws Exception {
// @formatter:off
http
.authorizeRequests()
.antMatchers("/").permitAll()
.anyRequest().authenticated();
// @formatter:on
}
Even thought, "/" url is allowed to anyone, 401 status code is responded at browser while your test case is green.
Thanks.
Looks like the test isn't configured correctly. The Spring Security filter chain needs to be included in the context. Thanks for reporting.
Thanks for quick fix.
I personally override another configure method for explicitly allow specific URL.
@Override
public void configure(WebSecurity web) throws Exception {
web
.ignoring()
.antMatchers("/");
}
Feel free to send a pull request if you think it makes more sense to configure it like that. I'm happy to merge. I'm just trying to keep the example as simple as possible so it's (mostly) obvious what is happening. Thanks!