/// <summary> /// create the SASL bind request,<para/> /// which is sent to server to request a SASL bind to provide more strong security. /// </summary> /// <param name="securityContext"> /// a ClientSecurityContext object that specifies the security provider. /// </param> /// <param name="enableMessageSecurity"> /// a bool value that indicates whether enable message security. /// </param> /// <returns> /// a BindRequestPacket object that requests the SASL bind. /// </returns> /// <exception cref="ArgumentNullException"> /// thrown when securityContext is null. /// </exception> public AdtsBindRequestPacket CreateSaslBindRequest( ClientSecurityContext securityContext, bool enableMessageSecurity) { if (securityContext == null) { throw new ArgumentNullException("securityContext"); } if (this.security == null) { this.usingMessageSecurity = enableMessageSecurity; this.security = new AdtsLdapSaslSecurityLayer(securityContext); } return(this.CreateSaslBindRequest(SASL_MECHANISM_GSS_SPNEGO, securityContext.Token)); }
/// <summary> /// complete the SSL/TLS authenticate<para/> /// which is used to start the SSL/TLS handshake with server,<para/> /// verify the certificate from server,<para/> /// establish the SSL/TLS security. /// </summary> /// <param name="targetHost"> /// a string that indicates the name of the server that shares the SSL/TLS. /// </param> /// <param name="enableMessageSecurity"> /// a bool value that indicates whether enable message security. /// </param> /// <exception cref="ArgumentNullException"> /// thrown when targetHost is null. /// </exception> public void SslAuthenticate(string targetHost, bool enableMessageSecurity) { if (targetHost == null) { throw new ArgumentNullException("targetHost"); } // if null or other security, initialize the ssl security. // when bind before start tls, the security will be set to other security. if (this.security == null || !(this.security is AdtsLdapSslTlsSecurityLayer)) { this.security = new AdtsLdapSslTlsSecurityLayer(this); this.usingMessageSecurity = enableMessageSecurity; } (this.security as AdtsLdapSslTlsSecurityLayer).AuthenticateAsClient(targetHost); }
/// <summary> /// create the Sicily bind request, <para/> /// which is sent to server to request a sicily bind, windows implements this as NTLM authenticate.<para/> /// this is the first roundtrip, which contains the Sicily Discovery request. /// </summary> /// <param name="securityContext"> /// a ClientSecurityContext object that specifies the security provider. /// </param> /// <param name="enableMessageSecurity"> /// a bool value that indicates whether enable message security. /// </param> /// <returns> /// a BindRequestPacket object that requests the Sicily bind. /// </returns> /// <exception cref="ArgumentNullException"> /// thrown when securityContext is null. /// </exception> public AdtsBindRequestPacket CreateSicilyRequest( ClientSecurityContext securityContext, bool enableMessageSecurity) { if (securityContext == null) { throw new ArgumentNullException("securityContext"); } if (this.security == null) { this.usingMessageSecurity = enableMessageSecurity; this.security = new AdtsLdapSaslSecurityLayer(securityContext); } if (securityContext.NeedContinueProcessing) { return(this.CreateSicilyNegotiateBindRequest(SICILY_AUTH_NAME_NTLM, securityContext.Token)); } else { return(this.CreateSicilyResponseBindRequest(securityContext.Token)); } }
/// <summary> /// complete the SSL/TLS authenticate<para/> /// which is used to start the SSL/TLS handshake with server,<para/> /// verify the certificate from server,<para/> /// establish the SSL/TLS security. /// </summary> /// <param name="targetHost"> /// a string that indicates the name of the server that shares the SSL/TLS. /// </param> /// <param name="enableMessageSecurity"> /// a bool value that indicates whether enable message security. /// </param> /// <exception cref="ArgumentNullException"> /// thrown when targetHost is null. /// </exception> public void SslAuthenticate(string targetHost, bool enableMessageSecurity) { if (targetHost == null) { throw new ArgumentNullException("targetHost"); } // if null or other security, initialize the ssl security. // when bind before start tls, the security will be set to other security. if (this.security == null || !(this.security is AdtsLdapSslTlsSecurityLayer)) { this.security = new AdtsLdapSslTlsSecurityLayer(this); this.usingMessageSecurity = enableMessageSecurity; } (this.security as AdtsLdapSslTlsSecurityLayer).AuthenticateAsClient(targetHost); }
/// <summary> /// create the Sicily bind request, <para/> /// which is sent to server to request a sicily bind, windows implements this as NTLM authenticate.<para/> /// this is the first roundtrip, which contains the Sicily Discovery request. /// </summary> /// <param name="securityContext"> /// a ClientSecurityContext object that specifies the security provider. /// </param> /// <param name="enableMessageSecurity"> /// a bool value that indicates whether enable message security. /// </param> /// <returns> /// a BindRequestPacket object that requests the Sicily bind. /// </returns> /// <exception cref="ArgumentNullException"> /// thrown when securityContext is null. /// </exception> public AdtsBindRequestPacket CreateSicilyRequest( ClientSecurityContext securityContext, bool enableMessageSecurity) { if (securityContext == null) { throw new ArgumentNullException("securityContext"); } if (this.security == null) { this.usingMessageSecurity = enableMessageSecurity; this.security = new AdtsLdapSaslSecurityLayer(securityContext); } if (securityContext.NeedContinueProcessing) { return this.CreateSicilyNegotiateBindRequest(SICILY_AUTH_NAME_NTLM, securityContext.Token); } else { return this.CreateSicilyResponseBindRequest(securityContext.Token); } }
/// <summary> /// create the SASL bind request,<para/> /// which is sent to server to request a SASL bind to provide more strong security. /// </summary> /// <param name="securityContext"> /// a ClientSecurityContext object that specifies the security provider. /// </param> /// <param name="enableMessageSecurity"> /// a bool value that indicates whether enable message security. /// </param> /// <returns> /// a BindRequestPacket object that requests the SASL bind. /// </returns> /// <exception cref="ArgumentNullException"> /// thrown when securityContext is null. /// </exception> public AdtsBindRequestPacket CreateSaslBindRequest( ClientSecurityContext securityContext, bool enableMessageSecurity) { if (securityContext == null) { throw new ArgumentNullException("securityContext"); } if (this.security == null) { this.usingMessageSecurity = enableMessageSecurity; this.security = new AdtsLdapSaslSecurityLayer(securityContext); } return this.CreateSaslBindRequest(SASL_MECHANISM_GSS_SPNEGO, securityContext.Token); }