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 方法調用的。

 

 

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