【发布时间】:2020-09-07 20:56:21
【问题描述】:
对于某些要求,我需要登录页面中用户提供的用户名和密码。 (由用户输入)
但是,我无法进入以下 SecurityConfig 的配置方法。
@EnableWebSecurity 公共类 SecurityConfig 扩展 WebSecurityConfigurerAdapter {
@Autowired
PasswordEncoder passwordEncoder;
@Autowired
DataSource dataSource;
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
**// Wants to get user-given username and password**
auth.jdbcAuthentication().dataSource(dataSource)
.passwordEncoder(passwordEncoder())
.usersByUsernameQuery("select username,password, true from user where username=?")
.authoritiesByUsernameQuery("select u.username, r.rolename from user u, role r where u.roleId = r.id and u.username=?");
}
}
【问题讨论】:
标签: spring spring-mvc spring-security spring-security-rest