Java Spring Security Form和Basic在同一配置中
下面是Java Spring Security Form和Basic在同一配置中,java,spring,spring-security,Java,Spring,Spring Security,下面是websecurityConfigureAdapter类的configure方法的默认实现 protected void configure(HttpSecurity http) throws Exception { logger.debug("Using default configure(HttpSecurity). If subclassed this will potentially override subclass configure(HttpSecurity
websecurityConfigureAdapter
类的configure方法的默认实现
protected void configure(HttpSecurity http) throws Exception {
logger.debug("Using default configure(HttpSecurity). If subclassed this will potentially override subclass configure(HttpSecurity).");
http
.authorizeRequests()
.anyRequest().authenticated()
.and()
.formLogin().and()
.httpBasic();
}
我知道默认情况下,身份验证方法是基于表单的,并提供了预构建的登录表单
但是httpBasic()
方法在这里有什么用途呢?如果我也移除它,我仍然看到相同的结果。
有人能解释一下为什么在这里使用它吗
另外,当auto config=“true”
我们总是在浏览器中看到登录页面而不是对话框。那么为什么这里指定了http basic呢
<http>
<form-login/>
<http-basic/>
<logout/>
</http>