spring security 之前端加密,后端解密

  1. 前端加密

这个先留着,以后再写。 

  1. 后端解密

后端解密主要是使用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 方法调用的。

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章