这个错误通常是因为Spring Security没有找到适合处理UsernamePasswordAuthenticationToken
的AuthenticationProvider
。UsernamePasswordAuthenticationToken
是Spring Security默认的用户名密码认证令牌,它包含用户输入的用户名和密码。我错在SecurityConfig中身份认证接口
这里不用多说 直接上代码
1.错误代码
/**
* 身份认证接口
*/
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception
{
if (!casProperties.isCasEnable()) {
auth.userDetailsService(userDetailsService).passwordEncoder(bCryptPasswordEncoder());
}
//cas
if (casProperties.isCasEnable()) {
super.configure(auth);
auth.authenticationProvider(casAuthenticationProvider());
}
}
修改以后:
/**
* 身份认证接口
*/
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception
{
auth.userDetailsService(userDetailsService).passwordEnco