WebSecurityConfigurerAdapter 在 configure(HttpSecurity http) 提供一个默认的配置:
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.anyRequest().authenticated()
.and()
.formLogin()
.and()
.httpBasic();
}
上面的默认配置:
1) 确保任何的用户请求需要身份验证。
2) 允许用户基于表单登录进行身份验证
3) 允许用户基于 HTTP Basic 身份验证验证身份
XML 命名空间配置:
<http>
<intercept-url pattern="/**" access="authenticated"/>
<form-login />
<http-basic />
</http>