- 前端加密
这个先留着,以后再写。
- 后端解密
后端解密主要是使用DaoAuthenticationProvider
DaoAuthenticationProvider 的继承关系如下:
DaoAuthenticationProvider->AbstractUserDetailsAuthenticationProvider->AuthenticationProvider
我们在实现的时候,其实是重写了
@Override
protected void additionalAuthenticationChecks(UserDetails userDetails,
UsernamePasswordAuthenticationToken authentication) throws AuthenticationException {
String password= authentication.getCredentials().toString();
password="111111111111111111";
UsernamePasswordAuthenticationToken newAuthentication = new UsernamePasswordAuthenticationToken(authentication.getPrincipal(), password);
newAuthentication.setDetails( authentication.getDetails() );
super.additionalAuthenticationChecks(userDetails, newAuthentication);
}
additionalAuthenticationChecks 方法是被authenticate 方法调用的。