public void AddServer(LdapDirectoryIdentifier identifier, int maxConnections, int protocolVersion = 3, bool ssl = false, double? timeout = null, NetworkCredential credentials = null, AuthType? authType = null)
        {
            var serverName = identifier.Servers[0];
            var factory = new LdapConnectionFactory(serverName);
            if (credentials != null)
                factory.AuthenticateAs(credentials);
            if (authType.HasValue)
                factory.AuthenticateBy(authType.Value);

            if (timeout.HasValue)
                factory.ConnectionTimeoutIn(timeout.Value);

            factory.ProtocolVersion(protocolVersion);

            if (identifier.FullyQualifiedDnsHostName)
                factory.ServerNameIsFullyQualified();

            if (identifier.Connectionless)
                factory.UseUdp();

            if (ssl) factory.UseSsl();

            factory.UsePort(identifier.PortNumber);

            _servers[serverName] = new ServerPoolMemberConnectionFactory(serverName, factory, maxConnections);
        }
コード例 #2
0
        public void AddServer(LdapDirectoryIdentifier identifier, int maxConnections, int protocolVersion = 3, bool ssl = false, double?timeout = null, NetworkCredential credentials = null, AuthType?authType = null)
        {
            var serverName = identifier.Servers[0];
            var factory    = new LdapConnectionFactory(serverName);

            if (credentials != null)
            {
                factory.AuthenticateAs(credentials);
            }
            if (authType.HasValue)
            {
                factory.AuthenticateBy(authType.Value);
            }

            if (timeout.HasValue)
            {
                factory.ConnectionTimeoutIn(timeout.Value);
            }

            factory.ProtocolVersion(protocolVersion);

            if (identifier.FullyQualifiedDnsHostName)
            {
                factory.ServerNameIsFullyQualified();
            }

            if (identifier.Connectionless)
            {
                factory.UseUdp();
            }

            if (ssl)
            {
                factory.UseSsl();
            }

            factory.UsePort(identifier.PortNumber);

            _servers[serverName] = new ServerPoolMemberConnectionFactory(serverName, factory, maxConnections);
        }