/// <summary> /// Initializes a new instance of the <see cref="ClusterCredentials"/> class. /// </summary> /// <param name="clusterUri">The cluster URI.</param> /// <param name="userName">The username.</param> /// <param name="password">The password.</param> public ClusterCredentials(Uri clusterUri, string userName, SecureString password) { clusterUri.ArgumentNotNull("clusterUri"); userName.ArgumentNotNullNorEmpty("username"); password.ArgumentNotNull("securePassword"); ClusterUri = clusterUri; UserName = userName; _clusterPassword = password.Copy(); _clusterPassword.MakeReadOnly(); }
internal static string GetCleartextFromSecureString(SecureString secureString) { secureString.ArgumentNotNull("secureString"); IntPtr bstr = Marshal.SecureStringToBSTR(secureString); string clearTextValue; try { clearTextValue = Marshal.PtrToStringBSTR(bstr); } finally { Marshal.FreeBSTR(bstr); } return clearTextValue; }