internal static extern bool CredRead(string targetName, NativeCredentialType type, CredentialFlags flags, out IntPtr credential);
/** * Tests if one or more credentials are set. * * @param credMask A logical or of the credential bit values. * @return true if the credentials are set. */ public bool IsSet(CredentialFlags credMask) { return(alljoyn_credentials_isset(_credentials, (ushort)credMask) == 1 ? true : false); }
internal static extern bool CredDelete (string targetName, NativeCredentialType type, CredentialFlags flags);
internal static extern bool CredRead (string targetName, NativeCredentialType type, CredentialFlags flags, out IntPtr credential);
internal static extern bool CredDelete(string targetName, NativeCredentialType type, CredentialFlags flags);
public void AcquireCredentials(string pwszRealm, string pwszSite, char[] pwszUser, int cchUser, char[] pwszPassword, int cchPassword, int hrStatus, ref CredentialFlags pdwFlags) { const string user = "******"; string[] pw = { "foo\0", "Moo\0" }; // If we are being called a second time (ie the first uid & pw were wrong), the // old values might be sent back to us. int t = Array.IndexOf(pwszUser, '\0'); // Look for the trailing null since string u = new string(pwszUser, 0, t); // the string construct is too dumb to look for it. t = Array.IndexOf(pwszPassword, '\0'); string p = new string(pwszPassword, 0, t); Debug.WriteLine(string.Format("uid: {0} pw: {1}", u, p)); char[] uc = user.ToCharArray(); // Doesn't include a trailing null by default Array.Copy(uc, pwszUser, uc.Length); // MUST use copy! Don't just assign into pwszUser char[] pc = pw[m_RequestCount].ToCharArray(); Array.Copy(pc, pwszPassword, pc.Length); m_RequestCount++; pdwFlags = CredentialFlags.ClearText; // Tell the caller what we're sending back }
/// <summary> /// Constructor with type, persistance, and flags. /// </summary> /// <param name="userName"></param> /// <param name="secret"></param> /// <param name="target"></param> /// <param name="type"></param> /// <param name="persist"></param> /// <param name="flags"></param> public Credential(string userName, string secret, string target, CredentialType type, CredentialPersistence persist, CredentialFlags flags) : this(userName, secret, target, type, persist) { this.Flags = flags; }
/// <summary> /// Constructor with flags. /// </summary> /// <param name="userName"></param> /// <param name="secret"></param> /// <param name="target"></param> /// <param name="flags"></param> public Credential(string userName, string secret, string target, CredentialFlags flags) : this(userName, secret, target) { this.Flags = flags; }
/** * Tests if one or more credentials are set. * * @param credMask A logical or of the credential bit values. * @return true if the credentials are set. */ public bool IsSet(CredentialFlags credMask) { return (alljoyn_credentials_isset(_credentials, (ushort)credMask) == 1 ? true : false); }