我有以下弹簧安全配置:
<authentication-manager alias="userAuthenticationManager">
<!-- <authentication-provider user-service-ref="userSecurityService"> -->
<authentication-provider>
<password-encoder ref="encoder" />
<jdbc-user-service data-source-ref="dataSource"
users-by-username-query="select email,password,prop_was_moderated from terminal_user where email = ? and prop_confirm_terminal=true"
authorities-by-username-query="select email,user_role from terminal_user where email = ?" />
</authentication-provider>
</authentication-manager>
<beans:bean id="encoder" class="org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder">
<beans:constructor-arg name="strength" value="10" />
</beans:bean>
以及以下配置类
@Configuration
public class Configiuration {
@Bean
BCryptPasswordEncoder bCryptPasswordEncoder(){
return new BCryptPasswordEncoder();
}
}
我创建了这样的用户密码:
...
@Autowired
private BCryptPasswordEncoder bCryptPasswordEncoder;
...
public void register(...){
...
user.setPassword(bCryptPasswordEncoder.encode(generatedPassword));
...
}
...
但是当我尝试登录时,我认为auth失败了。
我错了什么?