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");
        }
示例#2
0
 public static string ToDectryptString(this string encryptValue)
 {
     if (encryptValue == null || Convert.ToString(encryptValue) == string.Empty)
     {
         return("");
     }
     return(OHCryptographyHelper.DecryptString(encryptValue, OHCryptographySettings.KeyPassword,
                                               OHCryptographySettings.SaltPassword));
 }
示例#3
0
 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));
 }