public static string GetUserNameDisplay(this IIdentity identity) { var claim = ((ClaimsIdentity)identity).FindFirst(ClaimTypes.GivenName); // Test for null to avoid issues during local testing return((claim != null) ? OHCryptographyHelper.DecryptString(claim.Value, OHCryptographySettings.KeyPassword, OHCryptographySettings.SaltPassword) : "No User"); }
public static string ToDectryptString(this string encryptValue) { if (encryptValue == null || Convert.ToString(encryptValue) == string.Empty) { return(""); } return(OHCryptographyHelper.DecryptString(encryptValue, OHCryptographySettings.KeyPassword, OHCryptographySettings.SaltPassword)); }
public static string ToEncryptString(this object plainObject) { if (plainObject == null || Convert.ToString(plainObject) == string.Empty) { return(""); } return(OHCryptographyHelper.EncryptString(plainObject.ToString(), OHCryptographySettings.KeyPassword, OHCryptographySettings.SaltPassword)); }