【发布时间】:2017-12-08 02:38:00
【问题描述】:
如果我没有误解,AuthenticationProvider 使用UserDetailsService 检索用户的属性以验证Authentication 对象。
问题在于,在下一个代码中,AuthenticationProvider 和 UserDetailsService 都没有配置。
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication().withUser("user").password("pass").roles("ADMIN").and().withUser("user1")
.password("pass").roles("USER");
}
但是认证服务已经设置好了。
我的问题是,AuthenticationProvider 和 UserDetailsService 的另一个实现是否已在内部添加到 spring 上下文中?在这种情况下,使用的实现是什么(在 memoryAuthentication 的情况下)。
配置的*.withUser("user").password("pass").roles("ADMIN")* 部分是否代表UserDetailsService 实现?
【问题讨论】:
标签: java spring-security