public static string CreateToken(UserProfile userProfile, DateTime expires) { var token = new AccessTokenIdentity <int> { UserId = userProfile.Id, Expires = expires }; string input = ToJson(token); return(AesEncrypt(input)); }
public static AccessTokenIdentity <T> GetAccessToken <T>(string input) { string temp = AesDecrypt(input); if (string.IsNullOrWhiteSpace(temp)) { return(null); } AccessTokenIdentity <T> token = null; try { token = Deserialize <AccessTokenIdentity <T> >(temp); } catch (Exception) { } return(token); }