/// <summary> /// Creates a new Credentials /// </summary> public CimCredential(ImpersonatedAuthenticationMechanism authenticationMechanism) { string strAuthenticationMechanism = null; if (authenticationMechanism == ImpersonatedAuthenticationMechanism.None) { strAuthenticationMechanism = MI_AuthType.NONE; } else if (authenticationMechanism == ImpersonatedAuthenticationMechanism.Negotiate) { strAuthenticationMechanism = MI_AuthType.NEGO_NO_CREDS; } else if (authenticationMechanism == ImpersonatedAuthenticationMechanism.Kerberos) { strAuthenticationMechanism = MI_AuthType.KERBEROS; } else if (authenticationMechanism == ImpersonatedAuthenticationMechanism.NtlmDomain) { strAuthenticationMechanism = MI_AuthType.NTLM; } else { throw new ArgumentOutOfRangeException("authenticationMechanism"); } NativeCimCredential.CreateCimCredential(strAuthenticationMechanism, out credential); }
public CimCredential(CertificateAuthenticationMechanism authenticationMechanism, string certificateThumbprint) { string authTypeIssuerCert = null; if (authenticationMechanism != CertificateAuthenticationMechanism.Default) { if (authenticationMechanism != CertificateAuthenticationMechanism.ClientCertificate) { if (authenticationMechanism != CertificateAuthenticationMechanism.IssuerCertificate) { throw new ArgumentOutOfRangeException("authenticationMechanism"); } else { authTypeIssuerCert = AuthType.AuthTypeIssuerCert; } } else { authTypeIssuerCert = AuthType.AuthTypeClientCerts; } } else { authTypeIssuerCert = AuthType.AuthTypeClientCerts; } NativeCimCredential.CreateCimCredential(authTypeIssuerCert, certificateThumbprint, out this.credential); }
public CimCredential(ImpersonatedAuthenticationMechanism authenticationMechanism) { string authTypeNTLM = null; if (authenticationMechanism != ImpersonatedAuthenticationMechanism.None) { if (authenticationMechanism != ImpersonatedAuthenticationMechanism.Negotiate) { if (authenticationMechanism != ImpersonatedAuthenticationMechanism.Kerberos) { if (authenticationMechanism != ImpersonatedAuthenticationMechanism.NtlmDomain) { throw new ArgumentOutOfRangeException("authenticationMechanism"); } else { authTypeNTLM = AuthType.AuthTypeNTLM; } } else { authTypeNTLM = AuthType.AuthTypeKerberos; } } else { authTypeNTLM = AuthType.AuthTypeNegoNoCredentials; } } else { authTypeNTLM = AuthType.AuthTypeNone; } NativeCimCredential.CreateCimCredential(authTypeNTLM, out this.credential); }
/// <summary> /// Creates a new Credentials /// </summary> public CimCredential(string authenticationMechanism) { if (authenticationMechanism == null) { throw new ArgumentNullException("authenticationMechanism"); } NativeCimCredential.CreateCimCredential(authenticationMechanism, out credential); }
/// <summary> /// Creates a new Credentials /// </summary> public CimCredential(string authenticationMechanism, string domain, string userName, SecureString password) { if (authenticationMechanism == null) { throw new ArgumentNullException("authenticationMechanism"); } if (userName == null) { throw new ArgumentNullException("userName"); } NativeCimCredential.CreateCimCredential(authenticationMechanism, domain, userName, password, out credential); }
public CimCredential(string authenticationMechanism) { if (authenticationMechanism != null) { NativeCimCredential.CreateCimCredential(authenticationMechanism, out this.credential); return; } else { throw new ArgumentNullException("authenticationMechanism"); } }
public CimCredential(string authenticationMechanism, string domain, string userName, SecureString password) { if (authenticationMechanism != null) { if (userName != null) { NativeCimCredential.CreateCimCredential(authenticationMechanism, domain, userName, password, out this.credential); return; } else { throw new ArgumentNullException("userName"); } } else { throw new ArgumentNullException("authenticationMechanism"); } }
/// <summary> /// Creates a new Credentials /// </summary> public CimCredential(PasswordAuthenticationMechanism authenticationMechanism, string domain, string userName, SecureString password) { if (userName == null) { throw new ArgumentNullException("userName"); } string strAuthenticationMechanism = null; if (authenticationMechanism == PasswordAuthenticationMechanism.Default) { strAuthenticationMechanism = MI_AuthType.DEFAULT; } else if (authenticationMechanism == PasswordAuthenticationMechanism.Basic) { strAuthenticationMechanism = MI_AuthType.BASIC; } else if (authenticationMechanism == PasswordAuthenticationMechanism.Digest) { strAuthenticationMechanism = MI_AuthType.DIGEST; } else if (authenticationMechanism == PasswordAuthenticationMechanism.Negotiate) { strAuthenticationMechanism = MI_AuthType.NEGO_WITH_CREDS; } else if (authenticationMechanism == PasswordAuthenticationMechanism.Kerberos) { strAuthenticationMechanism = MI_AuthType.KERBEROS; } else if (authenticationMechanism == PasswordAuthenticationMechanism.NtlmDomain) { strAuthenticationMechanism = MI_AuthType.NTLM; } else if (authenticationMechanism == PasswordAuthenticationMechanism.CredSsp) { strAuthenticationMechanism = MI_AuthType.CREDSSP; } else { throw new ArgumentOutOfRangeException("authenticationMechanism"); } NativeCimCredential.CreateCimCredential(strAuthenticationMechanism, domain, userName, password, out credential); }
/// <summary> /// Creates a new Credentials /// </summary> public CimCredential(CertificateAuthenticationMechanism authenticationMechanism, string certificateThumbprint) { string strAuthenticationMechanism = null; if (authenticationMechanism == CertificateAuthenticationMechanism.Default) { strAuthenticationMechanism = MI_AuthType.CLIENT_CERTS; } else if (authenticationMechanism == CertificateAuthenticationMechanism.ClientCertificate) { strAuthenticationMechanism = MI_AuthType.CLIENT_CERTS; } else if (authenticationMechanism == CertificateAuthenticationMechanism.IssuerCertificate) { strAuthenticationMechanism = MI_AuthType.ISSUER_CERT; } else { throw new ArgumentOutOfRangeException("authenticationMechanism"); } NativeCimCredential.CreateCimCredential(strAuthenticationMechanism, certificateThumbprint, out credential); }
public CimCredential(PasswordAuthenticationMechanism authenticationMechanism, string domain, string userName, SecureString password) { if (userName != null) { string authTypeCredSSP = null; if (authenticationMechanism != PasswordAuthenticationMechanism.Default) { if (authenticationMechanism != PasswordAuthenticationMechanism.Basic) { if (authenticationMechanism != PasswordAuthenticationMechanism.Digest) { if (authenticationMechanism != PasswordAuthenticationMechanism.Negotiate) { if (authenticationMechanism != PasswordAuthenticationMechanism.Kerberos) { if (authenticationMechanism != PasswordAuthenticationMechanism.NtlmDomain) { if (authenticationMechanism != PasswordAuthenticationMechanism.CredSsp) { throw new ArgumentOutOfRangeException("authenticationMechanism"); } else { authTypeCredSSP = AuthType.AuthTypeCredSSP; } } else { authTypeCredSSP = AuthType.AuthTypeNTLM; } } else { authTypeCredSSP = AuthType.AuthTypeKerberos; } } else { authTypeCredSSP = AuthType.AuthTypeNegoWithCredentials; } } else { authTypeCredSSP = AuthType.AuthTypeDigest; } } else { authTypeCredSSP = AuthType.AuthTypeBasic; } } else { authTypeCredSSP = AuthType.AuthTypeDefault; } NativeCimCredential.CreateCimCredential(authTypeCredSSP, domain, userName, password, out this.credential); return; } else { throw new ArgumentNullException("userName"); } }