LdapClient

Overview

LdapClient is a general purpose class for querying a remote Ldap server. It can connect to any server that implements the Ldap protocol, login and search the records the server is authorized to show.

Location

 

constructor

Constructor for the Ldap client class.

 

constructor

 

LdapClient()

 

init()

 

Sub New()

AllAttributes

A constant to pass to the Search API when the server should return all records.

 

const AllAttributes: String = '*'

 

const String AllAttributes = "*"

 

static let AllAttributes: String = "*"

 

Const AllAttributes As String = "*"

Bind

Bind is used to login, this overload let's you override the DN and password used to login.

 

method Bind

 

void Bind()

 

func Bind()

 

Sub Bind()

Bind (String, String, DigestType)

Bind is used to login, this overload let's you override the DN and password used to login.

 

method Bind(dn: String; password: String; digestType: DigestType)

 

void Bind(String dn, String password, DigestType digestType)

 

func Bind(_ dn: String, _ password: String, _ digestType: DigestType)

 

Sub Bind(dn As String, password As String, digestType As DigestType)

Parameters:

  • dn: Distinguished name
  • password: Password
  • digestType: Authentication method

BindDigest

BindDigest is used to define what authentication method is used. Currently only "None" is supported, which uses plain text authentication. Using StartTLS is recommended.

 

property BindDigest: DigestType read write;

 

DigestType BindDigest { get; set; }

 

var BindDigest: DigestType { get{} set{} }

 

Property BindDigest() As DigestType

BindDN

BindDN is the distinguished name used to login (bind) to the Ldap server. A DN is an Ldap identifier like: uid=user,ou=users,dc=company,dc=com.

 

property BindDN: String read write;

 

String BindDN { get; set; }

 

var BindDN: String { get{} set{} }

 

Property BindDN() As String

BindingV4    (declared in Client)

Gets the binding which provides properties and methods such as address family, IPv4 address, port number etc for client to connect to the host network.

 

property BindingV4: Binding read;

 

Binding BindingV4 { get; }

 

var BindingV4: Binding { get{} }

 

ReadOnly Property BindingV4() As Binding

BindingV6    (declared in Client)

Gets the binding which provides properties and methods such as address family, IPv6 address, port number etc for client to connect to the host network.

 

property BindingV6: Binding read;

 

Binding BindingV6 { get; }

 

var BindingV6: Binding { get{} }

 

ReadOnly Property BindingV6() As Binding

BindPassword

BindPassword is the password used to login (bind) to the server.

 

property BindPassword: String read write;

 

String BindPassword { get; set; }

 

var BindPassword: String { get{} set{} }

 

Property BindPassword() As String

Close

Logs out and disconnects.

 

method Close

 

void Close()

 

func Close()

 

Sub Close()

Connect    (declared in Client)

 

method Connect: Connection

 

Connection Connect()

 

func Connect() -> Connection

 

Function Connect() As Connection

Connect (IPAddress, Int32): Connection    (declared in Client)

 

method Connect(host: IPAddress; port: Int32): Connection

 

Connection Connect(IPAddress host, Int32 port)

 

func Connect(_ host: IPAddress, _ port: Int32) -> Connection

 

Function Connect(host As IPAddress, port As Int32) As Connection

Parameters:

  • host:
  • port:

Connect (String, Int32): Connection    (declared in Client)

 

method Connect(hostname: String; port: Int32): Connection

 

Connection Connect(String hostname, Int32 port)

 

func Connect(_ hostname: String, _ port: Int32) -> Connection

 

Function Connect(hostname As String, port As Int32) As Connection

Parameters:

  • hostname:
  • port:

Connect (IPAddress, Int32, Binding): Connection    (declared in Client)

Overloaded. Use to connect the client to a remote network host using the specified host name (HostName) or IP address (HostAddress) and port number (Port) and/or Binding (BindingV4 or BindingV6).

 

class method Connect(host: IPAddress; port: Int32; binding: Binding): Connection

 

static Connection Connect(IPAddress host, Int32 port, Binding binding)

 

static func Connect(_ host: IPAddress, _ port: Int32, _ binding: Binding) -> Connection

 

Shared Function Connect(host As IPAddress, port As Int32, binding As Binding) As Connection

Parameters:

  • host:
  • port:
  • binding:

Connect (String, Int32, Binding): Connection    (declared in Client)

Overloaded. Use to connect the client to a remote network host using the specified host name (HostName) or IP address (HostAddress) and port number (Port) and/or Binding (BindingV4 or BindingV6).

 

class method Connect(hostname: String; port: Int32; binding: Binding): Connection

 

static Connection Connect(String hostname, Int32 port, Binding binding)

 

static func Connect(_ hostname: String, _ port: Int32, _ binding: Binding) -> Connection

 

Shared Function Connect(hostname As String, port As Int32, binding As Binding) As Connection

Parameters:

  • hostname:
  • port:
  • binding:

Connected

True when there is an active server connection.

 

property Connected: Boolean read;

 

Boolean Connected { get; }

 

var Connected: Boolean { get{} }

 

ReadOnly Property Connected() As Boolean

ConnectionClass    (declared in Client)

Use the ConnectionClass property to specify an alternative Connection class to be used for out coming data connections. The class described by the assigned Type must be a descendant of Connection, and will be used for all connections that are established after the property has been set. Existing connections are not affected by changing the property.

If ConnectionType is null (default), instances of the Connection base class will be used.

 

property ConnectionClass: Type read write;

 

Type ConnectionClass { get; set; }

 

var ConnectionClass: Type { get{} set{} }

 

Property ConnectionClass() As Type

ConnectionFactory    (declared in Client)

Represents an interface for a connection.

 

property ConnectionFactory: IConnectionFactory read write;

 

IConnectionFactory ConnectionFactory { get; set; }

 

var ConnectionFactory: IConnectionFactory { get{} set{} }

 

Property ConnectionFactory() As IConnectionFactory

ConnectionPool  protected    (declared in Client)

 

property ConnectionPool: ConnectionPool read write;

 

ConnectionPool ConnectionPool { get; set; }

 

var ConnectionPool: ConnectionPool { get{} set{} }

 

Property ConnectionPool() As ConnectionPool

ConnectNew (IPAddress, Int32): Connection    (declared in Client)

Overloaded. Opens and returns new connection with specified IP address and port.

 

method ConnectNew(host: IPAddress; port: Int32): Connection

 

Connection ConnectNew(IPAddress host, Int32 port)

 

func ConnectNew(_ host: IPAddress, _ port: Int32) -> Connection

 

Function ConnectNew(host As IPAddress, port As Int32) As Connection

Parameters:

  • host:
  • port:

ConnectNew (String, Int32): Connection    (declared in Client)

 

method ConnectNew(hostname: String; port: Int32): Connection

 

Connection ConnectNew(String hostname, Int32 port)

 

func ConnectNew(_ hostname: String, _ port: Int32) -> Connection

 

Function ConnectNew(hostname As String, port As Int32) As Connection

Parameters:

  • hostname:
  • port:

CurrentConnection

Returns the current connection instance.

 

property CurrentConnection: Connection read;

 

Connection CurrentConnection { get; }

 

var CurrentConnection: Connection { get{} }

 

ReadOnly Property CurrentConnection() As Connection

DnsResolveType    (declared in Client)

Determines if the specified HostName should be look up only Once per application run (if you establish multiple connections to the server, the subsequent connections will use the cached IPAddress) or Always, for each connect (the Hostname will be resolved again for each subsequet connect).

You'll usually only change this setting off the defaut (Once) if you anticipate the IPAddress of the target host to change frequently.

 

[DefaultValue(DnsResolveType.Once)]
property DnsResolveType: DnsResolveType read write;

 

[DefaultValue(DnsResolveType.Once)]
DnsResolveType DnsResolveType { get; set; }

 

@DefaultValue(DnsResolveType.Once)
var DnsResolveType: DnsResolveType { get{} set{} }

 

<DefaultValue(DnsResolveType.Once)>
Property DnsResolveType() As DnsResolveType

EnableNagle    (declared in Client)

Set its value to true to enable the Nagle algorithm for send coalescing.

 

[DefaultValue(false)]
property EnableNagle: Boolean read write;

 

[DefaultValue(false)]
Boolean EnableNagle { get; set; }

 

@DefaultValue(false)
var EnableNagle: Boolean { get{} set{} }

 

<DefaultValue(false)>
Property EnableNagle() As Boolean

Escape

Escapes a string so it can be used as a value for an Ldap search filter.

 

class method Escape(s: String): String

 

static String Escape(String s)

 

static func Escape(_ s: String) -> String

 

Shared Function Escape(s As String) As String

Parameters:

  • s: the string to escape

GetConnection  protected    (declared in Client)

 

method GetConnection(host: IPAddress; port: Int32): Connection

 

Connection GetConnection(IPAddress host, Int32 port)

 

func GetConnection(_ host: IPAddress, _ port: Int32) -> Connection

 

Function GetConnection(host As IPAddress, port As Int32) As Connection

Parameters:

  • host:
  • port:

GetDefaultConnectionPool  protected    (declared in Client)

 

method GetDefaultConnectionPool: ConnectionPool

 

ConnectionPool GetDefaultConnectionPool()

 

func GetDefaultConnectionPool() -> ConnectionPool

 

Function GetDefaultConnectionPool() As ConnectionPool

HostAddress    (declared in Client)

Gets or sets an Internet Protocol (IP) address.

 

property HostAddress: IPAddress read write;

 

IPAddress HostAddress { get; set; }

 

var HostAddress: IPAddress { get{} set{} }

 

Property HostAddress() As IPAddress

HostName    (declared in Client)

The server host name or IP address that you intend the client to connect to.

 

property HostName: String read write;

 

String HostName { get; set; }

 

var HostName: String { get{} set{} }

 

Property HostName() As String

LdapPort

Contains 389, the default port for Ldap.

 

const LdapPort: Int32 = 389

 

const Int32 LdapPort = 389

 

static let LdapPort: Int32 = 389

 

Const LdapPort As Int32 = 389

LdapSPort

Contains 636, the default port for Ldap wrapped with Ssl.

 

const LdapSPort: Int32 = 636

 

const Int32 LdapSPort = 636

 

static let LdapSPort: Int32 = 636

 

Const LdapSPort As Int32 = 636

LdapVersion

Contains the Ldap version to use to login. Generally, you want to keep this on 3.

 

property LdapVersion: Int32 read write;

 

Int32 LdapVersion { get; set; }

 

var LdapVersion: Int32 { get{} set{} }

 

Property LdapVersion() As Int32

LoggedIn

True if a Bind call succeeded.

 

property LoggedIn: Boolean read;

 

Boolean LoggedIn { get; }

 

var LoggedIn: Boolean { get{} }

 

ReadOnly Property LoggedIn() As Boolean

NewConnection  protected    (declared in Client)

 

method NewConnection(binding: Binding): Connection

 

Connection NewConnection(Binding binding)

 

func NewConnection(_ binding: Binding) -> Connection

 

Function NewConnection(binding As Binding) As Connection

Parameters:

  • binding:

NoAttributes

Contains the string to pass to Search when the server should return no attributes.

 

const NoAttributes: String = '1.1'

 

const String NoAttributes = "1.1"

 

static let NoAttributes: String = "1.1"

 

Const NoAttributes As String = "1.1"

OnResolvedHostName    (declared in Client)

This event is fired after the hostname has been successfully resolved.

 

event OnResolvedHostName: EventHandler<ResolvedHostNameEventArgs>

 

delegate EventHandler<ResolvedHostNameEventArgs> OnResolvedHostName()

 

__event EventHandler<ResolvedHostNameEventArgs>: OnResolvedHostName!

 

Event OnResolvedHostName As EventHandler<ResolvedHostNameEventArgs>

OnResolveHostName    (declared in Client)

This event is fired before the Client attepts to resolve the sepcifed HostName to an IP address. It provides you with an option to perform the resolution yourself, obtain the IP address from an internal cache you're maintaing, or do some other processing (such as for example chaging the hostname to look up).

 

event OnResolveHostName: EventHandler<ResolveHostNameEventArgs>

 

delegate EventHandler<ResolveHostNameEventArgs> OnResolveHostName()

 

__event EventHandler<ResolveHostNameEventArgs>: OnResolveHostName!

 

Event OnResolveHostName As EventHandler<ResolveHostNameEventArgs>

Open

Connects and initializes TLS if necessary.

 

method Open

 

void Open()

 

func Open()

 

Sub Open()

Port    (declared in Client)

The server Port that you intend the client to connect to.

 

property Port: Int32 read write;

 

Int32 Port { get; set; }

 

var Port: Int32 { get{} set{} }

 

Property Port() As Int32

ReleaseConnection  protected    (declared in Client)

 

method ReleaseConnection(connection: Connection)

 

void ReleaseConnection(Connection connection)

 

func ReleaseConnection(_ connection: Connection)

 

Sub ReleaseConnection(connection As Connection)

Parameters:

  • connection:

ResolveHostName  protected    (declared in Client)

 

method ResolveHostName

 

void ResolveHostName()

 

func ResolveHostName()

 

Sub ResolveHostName()

ResolveHostNameIfNeeded  protected    (declared in Client)

 

method ResolveHostNameIfNeeded

 

void ResolveHostNameIfNeeded()

 

func ResolveHostNameIfNeeded()

 

Sub ResolveHostNameIfNeeded()

Executes a search on the Ldap server. The parameters passed define where to search and what to return.

 

method Search(baseObject: String; scope: SearchScope; aliases: AliasDereferencing; size: Int32; time: Int32; typesOnly: Boolean; filter: String; attributes: array of String): LdapSearchResults

 

LdapSearchResults Search(String baseObject, SearchScope scope, AliasDereferencing aliases, Int32 size, Int32 time, Boolean typesOnly, String filter, String[] attributes)

 

func Search(_ baseObject: String, _ scope: SearchScope, _ aliases: AliasDereferencing, _ size: Int32, _ time: Int32, _ typesOnly: Boolean, _ filter: String, _ attributes: String...) -> LdapSearchResults

 

Function Search(baseObject As String, scope As SearchScope, aliases As AliasDereferencing, size As Int32, time As Int32, typesOnly As Boolean, filter As String, attributes As String()) As LdapSearchResults

Parameters:

  • baseObject: The base distinguished name to start searching from
  • scope: The depth to execute this search query on
  • aliases: Indicates if aliases should be dereferenced and up to what level
  • size: The maximum number of items to return, or 0 if no client side maximum has to be enforced
  • time: The maximum number of seconds to spend searching for a record, or 0 if no client side limit has to be enforced
  • typesOnly: When true, only the attribute names (descriptions) are returned, not their value
  • filter: Filter in rfc 1960 format. If none is passed it will use "(objectClass=*)" which will return any object
  • attributes: Attributes to search for. Pass AllAttributes to return all attributes, or NoAttributes to return none

SslOptions    (declared in Client)

Gets the SslConnectionFactory instance that can be used to configure the SSL options of the current instance.

 

property SslOptions: SslConnectionFactory read write;

 

SslConnectionFactory SslOptions { get; set; }

 

var SslOptions: SslConnectionFactory { get{} set{} }

 

Property SslOptions() As SslConnectionFactory

TriggerOnResolvedHostName  protected    (declared in Client)

 

method TriggerOnResolvedHostName(e: ResolvedHostNameEventArgs)

 

void TriggerOnResolvedHostName(ResolvedHostNameEventArgs e)

 

func TriggerOnResolvedHostName(_ e: ResolvedHostNameEventArgs)

 

Sub TriggerOnResolvedHostName(e As ResolvedHostNameEventArgs)

Parameters:

  • e:

TriggerOnResolveHostName  protected    (declared in Client)

 

method TriggerOnResolveHostName(e: ResolveHostNameEventArgs)

 

void TriggerOnResolveHostName(ResolveHostNameEventArgs e)

 

func TriggerOnResolveHostName(_ e: ResolveHostNameEventArgs)

 

Sub TriggerOnResolveHostName(e As ResolveHostNameEventArgs)

Parameters:

  • e:

Unbind

Logs out.

 

method Unbind

 

void Unbind()

 

func Unbind()

 

Sub Unbind()

UseStartTLS

When UseStartTLS is set, the client will try to initiate a TLS connection after connecting. Note that this requires the server to implement the StartTLS extension. An alternative is to set the SslOptions.Enabled to true to wrap the entire connection in SSL (generally uses port 636 instead of 389).

 

property UseStartTLS: Boolean read write;

 

Boolean UseStartTLS { get; set; }

 

var UseStartTLS: Boolean { get{} set{} }

 

Property UseStartTLS() As Boolean

 

AllAttributes

A constant to pass to the Search API when the server should return all records.

 

const AllAttributes: String = '*'

 

const String AllAttributes = "*"

 

static let AllAttributes: String = "*"

 

Const AllAttributes As String = "*"

LdapPort

Contains 389, the default port for Ldap.

 

const LdapPort: Int32 = 389

 

const Int32 LdapPort = 389

 

static let LdapPort: Int32 = 389

 

Const LdapPort As Int32 = 389

LdapSPort

Contains 636, the default port for Ldap wrapped with Ssl.

 

const LdapSPort: Int32 = 636

 

const Int32 LdapSPort = 636

 

static let LdapSPort: Int32 = 636

 

Const LdapSPort As Int32 = 636

NoAttributes

Contains the string to pass to Search when the server should return no attributes.

 

const NoAttributes: String = '1.1'

 

const String NoAttributes = "1.1"

 

static let NoAttributes: String = "1.1"

 

Const NoAttributes As String = "1.1"

 

BindDigest

BindDigest is used to define what authentication method is used. Currently only "None" is supported, which uses plain text authentication. Using StartTLS is recommended.

 

property BindDigest: DigestType read write;

 

DigestType BindDigest { get; set; }

 

var BindDigest: DigestType { get{} set{} }

 

Property BindDigest() As DigestType

BindDN

BindDN is the distinguished name used to login (bind) to the Ldap server. A DN is an Ldap identifier like: uid=user,ou=users,dc=company,dc=com.

 

property BindDN: String read write;

 

String BindDN { get; set; }

 

var BindDN: String { get{} set{} }

 

Property BindDN() As String

BindingV4    (declared in Client)

Gets the binding which provides properties and methods such as address family, IPv4 address, port number etc for client to connect to the host network.

 

property BindingV4: Binding read;

 

Binding BindingV4 { get; }

 

var BindingV4: Binding { get{} }

 

ReadOnly Property BindingV4() As Binding

BindingV6    (declared in Client)

Gets the binding which provides properties and methods such as address family, IPv6 address, port number etc for client to connect to the host network.

 

property BindingV6: Binding read;

 

Binding BindingV6 { get; }

 

var BindingV6: Binding { get{} }

 

ReadOnly Property BindingV6() As Binding

BindPassword

BindPassword is the password used to login (bind) to the server.

 

property BindPassword: String read write;

 

String BindPassword { get; set; }

 

var BindPassword: String { get{} set{} }

 

Property BindPassword() As String

Connected

True when there is an active server connection.

 

property Connected: Boolean read;

 

Boolean Connected { get; }

 

var Connected: Boolean { get{} }

 

ReadOnly Property Connected() As Boolean

ConnectionClass    (declared in Client)

Use the ConnectionClass property to specify an alternative Connection class to be used for out coming data connections. The class described by the assigned Type must be a descendant of Connection, and will be used for all connections that are established after the property has been set. Existing connections are not affected by changing the property.

If ConnectionType is null (default), instances of the Connection base class will be used.

 

property ConnectionClass: Type read write;

 

Type ConnectionClass { get; set; }

 

var ConnectionClass: Type { get{} set{} }

 

Property ConnectionClass() As Type

ConnectionFactory    (declared in Client)

Represents an interface for a connection.

 

property ConnectionFactory: IConnectionFactory read write;

 

IConnectionFactory ConnectionFactory { get; set; }

 

var ConnectionFactory: IConnectionFactory { get{} set{} }

 

Property ConnectionFactory() As IConnectionFactory

ConnectionPool  protected    (declared in Client)

 

property ConnectionPool: ConnectionPool read write;

 

ConnectionPool ConnectionPool { get; set; }

 

var ConnectionPool: ConnectionPool { get{} set{} }

 

Property ConnectionPool() As ConnectionPool

CurrentConnection

Returns the current connection instance.

 

property CurrentConnection: Connection read;

 

Connection CurrentConnection { get; }

 

var CurrentConnection: Connection { get{} }

 

ReadOnly Property CurrentConnection() As Connection

DnsResolveType    (declared in Client)

Determines if the specified HostName should be look up only Once per application run (if you establish multiple connections to the server, the subsequent connections will use the cached IPAddress) or Always, for each connect (the Hostname will be resolved again for each subsequet connect).

You'll usually only change this setting off the defaut (Once) if you anticipate the IPAddress of the target host to change frequently.

 

[DefaultValue(DnsResolveType.Once)]
property DnsResolveType: DnsResolveType read write;

 

[DefaultValue(DnsResolveType.Once)]
DnsResolveType DnsResolveType { get; set; }

 

@DefaultValue(DnsResolveType.Once)
var DnsResolveType: DnsResolveType { get{} set{} }

 

<DefaultValue(DnsResolveType.Once)>
Property DnsResolveType() As DnsResolveType

EnableNagle    (declared in Client)

Set its value to true to enable the Nagle algorithm for send coalescing.

 

[DefaultValue(false)]
property EnableNagle: Boolean read write;

 

[DefaultValue(false)]
Boolean EnableNagle { get; set; }

 

@DefaultValue(false)
var EnableNagle: Boolean { get{} set{} }

 

<DefaultValue(false)>
Property EnableNagle() As Boolean

HostAddress    (declared in Client)

Gets or sets an Internet Protocol (IP) address.

 

property HostAddress: IPAddress read write;

 

IPAddress HostAddress { get; set; }

 

var HostAddress: IPAddress { get{} set{} }

 

Property HostAddress() As IPAddress

HostName    (declared in Client)

The server host name or IP address that you intend the client to connect to.

 

property HostName: String read write;

 

String HostName { get; set; }

 

var HostName: String { get{} set{} }

 

Property HostName() As String

LdapVersion

Contains the Ldap version to use to login. Generally, you want to keep this on 3.

 

property LdapVersion: Int32 read write;

 

Int32 LdapVersion { get; set; }

 

var LdapVersion: Int32 { get{} set{} }

 

Property LdapVersion() As Int32

LoggedIn

True if a Bind call succeeded.

 

property LoggedIn: Boolean read;

 

Boolean LoggedIn { get; }

 

var LoggedIn: Boolean { get{} }

 

ReadOnly Property LoggedIn() As Boolean

Port    (declared in Client)

The server Port that you intend the client to connect to.

 

property Port: Int32 read write;

 

Int32 Port { get; set; }

 

var Port: Int32 { get{} set{} }

 

Property Port() As Int32

SslOptions    (declared in Client)

Gets the SslConnectionFactory instance that can be used to configure the SSL options of the current instance.

 

property SslOptions: SslConnectionFactory read write;

 

SslConnectionFactory SslOptions { get; set; }

 

var SslOptions: SslConnectionFactory { get{} set{} }

 

Property SslOptions() As SslConnectionFactory

UseStartTLS

When UseStartTLS is set, the client will try to initiate a TLS connection after connecting. Note that this requires the server to implement the StartTLS extension. An alternative is to set the SslOptions.Enabled to true to wrap the entire connection in SSL (generally uses port 636 instead of 389).

 

property UseStartTLS: Boolean read write;

 

Boolean UseStartTLS { get; set; }

 

var UseStartTLS: Boolean { get{} set{} }

 

Property UseStartTLS() As Boolean

 

Connect (IPAddress, Int32, Binding): Connection    (declared in Client)

Overloaded. Use to connect the client to a remote network host using the specified host name (HostName) or IP address (HostAddress) and port number (Port) and/or Binding (BindingV4 or BindingV6).

 

class method Connect(host: IPAddress; port: Int32; binding: Binding): Connection

 

static Connection Connect(IPAddress host, Int32 port, Binding binding)

 

static func Connect(_ host: IPAddress, _ port: Int32, _ binding: Binding) -> Connection

 

Shared Function Connect(host As IPAddress, port As Int32, binding As Binding) As Connection

Parameters:

  • host:
  • port:
  • binding:

Connect (String, Int32, Binding): Connection    (declared in Client)

Overloaded. Use to connect the client to a remote network host using the specified host name (HostName) or IP address (HostAddress) and port number (Port) and/or Binding (BindingV4 or BindingV6).

 

class method Connect(hostname: String; port: Int32; binding: Binding): Connection

 

static Connection Connect(String hostname, Int32 port, Binding binding)

 

static func Connect(_ hostname: String, _ port: Int32, _ binding: Binding) -> Connection

 

Shared Function Connect(hostname As String, port As Int32, binding As Binding) As Connection

Parameters:

  • hostname:
  • port:
  • binding:

Escape

Escapes a string so it can be used as a value for an Ldap search filter.

 

class method Escape(s: String): String

 

static String Escape(String s)

 

static func Escape(_ s: String) -> String

 

Shared Function Escape(s As String) As String

Parameters:

  • s: the string to escape

 

constructor

Constructor for the Ldap client class.

 

constructor

 

LdapClient()

 

init()

 

Sub New()

Bind

Bind is used to login, this overload let's you override the DN and password used to login.

 

method Bind

 

void Bind()

 

func Bind()

 

Sub Bind()

Bind (String, String, DigestType)

Bind is used to login, this overload let's you override the DN and password used to login.

 

method Bind(dn: String; password: String; digestType: DigestType)

 

void Bind(String dn, String password, DigestType digestType)

 

func Bind(_ dn: String, _ password: String, _ digestType: DigestType)

 

Sub Bind(dn As String, password As String, digestType As DigestType)

Parameters:

  • dn: Distinguished name
  • password: Password
  • digestType: Authentication method

Close

Logs out and disconnects.

 

method Close

 

void Close()

 

func Close()

 

Sub Close()

Connect    (declared in Client)

 

method Connect: Connection

 

Connection Connect()

 

func Connect() -> Connection

 

Function Connect() As Connection

Connect (IPAddress, Int32): Connection    (declared in Client)

 

method Connect(host: IPAddress; port: Int32): Connection

 

Connection Connect(IPAddress host, Int32 port)

 

func Connect(_ host: IPAddress, _ port: Int32) -> Connection

 

Function Connect(host As IPAddress, port As Int32) As Connection

Parameters:

  • host:
  • port:

Connect (String, Int32): Connection    (declared in Client)

 

method Connect(hostname: String; port: Int32): Connection

 

Connection Connect(String hostname, Int32 port)

 

func Connect(_ hostname: String, _ port: Int32) -> Connection

 

Function Connect(hostname As String, port As Int32) As Connection

Parameters:

  • hostname:
  • port:

ConnectNew (IPAddress, Int32): Connection    (declared in Client)

Overloaded. Opens and returns new connection with specified IP address and port.

 

method ConnectNew(host: IPAddress; port: Int32): Connection

 

Connection ConnectNew(IPAddress host, Int32 port)

 

func ConnectNew(_ host: IPAddress, _ port: Int32) -> Connection

 

Function ConnectNew(host As IPAddress, port As Int32) As Connection

Parameters:

  • host:
  • port:

ConnectNew (String, Int32): Connection    (declared in Client)

 

method ConnectNew(hostname: String; port: Int32): Connection

 

Connection ConnectNew(String hostname, Int32 port)

 

func ConnectNew(_ hostname: String, _ port: Int32) -> Connection

 

Function ConnectNew(hostname As String, port As Int32) As Connection

Parameters:

  • hostname:
  • port:

GetConnection  protected    (declared in Client)

 

method GetConnection(host: IPAddress; port: Int32): Connection

 

Connection GetConnection(IPAddress host, Int32 port)

 

func GetConnection(_ host: IPAddress, _ port: Int32) -> Connection

 

Function GetConnection(host As IPAddress, port As Int32) As Connection

Parameters:

  • host:
  • port:

GetDefaultConnectionPool  protected    (declared in Client)

 

method GetDefaultConnectionPool: ConnectionPool

 

ConnectionPool GetDefaultConnectionPool()

 

func GetDefaultConnectionPool() -> ConnectionPool

 

Function GetDefaultConnectionPool() As ConnectionPool

NewConnection  protected    (declared in Client)

 

method NewConnection(binding: Binding): Connection

 

Connection NewConnection(Binding binding)

 

func NewConnection(_ binding: Binding) -> Connection

 

Function NewConnection(binding As Binding) As Connection

Parameters:

  • binding:

Open

Connects and initializes TLS if necessary.

 

method Open

 

void Open()

 

func Open()

 

Sub Open()

ReleaseConnection  protected    (declared in Client)

 

method ReleaseConnection(connection: Connection)

 

void ReleaseConnection(Connection connection)

 

func ReleaseConnection(_ connection: Connection)

 

Sub ReleaseConnection(connection As Connection)

Parameters:

  • connection:

ResolveHostName  protected    (declared in Client)

 

method ResolveHostName

 

void ResolveHostName()

 

func ResolveHostName()

 

Sub ResolveHostName()

ResolveHostNameIfNeeded  protected    (declared in Client)

 

method ResolveHostNameIfNeeded

 

void ResolveHostNameIfNeeded()

 

func ResolveHostNameIfNeeded()

 

Sub ResolveHostNameIfNeeded()

Executes a search on the Ldap server. The parameters passed define where to search and what to return.

 

method Search(baseObject: String; scope: SearchScope; aliases: AliasDereferencing; size: Int32; time: Int32; typesOnly: Boolean; filter: String; attributes: array of String): LdapSearchResults

 

LdapSearchResults Search(String baseObject, SearchScope scope, AliasDereferencing aliases, Int32 size, Int32 time, Boolean typesOnly, String filter, String[] attributes)

 

func Search(_ baseObject: String, _ scope: SearchScope, _ aliases: AliasDereferencing, _ size: Int32, _ time: Int32, _ typesOnly: Boolean, _ filter: String, _ attributes: String...) -> LdapSearchResults

 

Function Search(baseObject As String, scope As SearchScope, aliases As AliasDereferencing, size As Int32, time As Int32, typesOnly As Boolean, filter As String, attributes As String()) As LdapSearchResults

Parameters:

  • baseObject: The base distinguished name to start searching from
  • scope: The depth to execute this search query on
  • aliases: Indicates if aliases should be dereferenced and up to what level
  • size: The maximum number of items to return, or 0 if no client side maximum has to be enforced
  • time: The maximum number of seconds to spend searching for a record, or 0 if no client side limit has to be enforced
  • typesOnly: When true, only the attribute names (descriptions) are returned, not their value
  • filter: Filter in rfc 1960 format. If none is passed it will use "(objectClass=*)" which will return any object
  • attributes: Attributes to search for. Pass AllAttributes to return all attributes, or NoAttributes to return none

TriggerOnResolvedHostName  protected    (declared in Client)

 

method TriggerOnResolvedHostName(e: ResolvedHostNameEventArgs)

 

void TriggerOnResolvedHostName(ResolvedHostNameEventArgs e)

 

func TriggerOnResolvedHostName(_ e: ResolvedHostNameEventArgs)

 

Sub TriggerOnResolvedHostName(e As ResolvedHostNameEventArgs)

Parameters:

  • e:

TriggerOnResolveHostName  protected    (declared in Client)

 

method TriggerOnResolveHostName(e: ResolveHostNameEventArgs)

 

void TriggerOnResolveHostName(ResolveHostNameEventArgs e)

 

func TriggerOnResolveHostName(_ e: ResolveHostNameEventArgs)

 

Sub TriggerOnResolveHostName(e As ResolveHostNameEventArgs)

Parameters:

  • e:

Unbind

Logs out.

 

method Unbind

 

void Unbind()

 

func Unbind()

 

Sub Unbind()

 

OnResolvedHostName    (declared in Client)

This event is fired after the hostname has been successfully resolved.

 

event OnResolvedHostName: EventHandler<ResolvedHostNameEventArgs>

 

delegate EventHandler<ResolvedHostNameEventArgs> OnResolvedHostName()

 

__event EventHandler<ResolvedHostNameEventArgs>: OnResolvedHostName!

 

Event OnResolvedHostName As EventHandler<ResolvedHostNameEventArgs>

OnResolveHostName    (declared in Client)

This event is fired before the Client attepts to resolve the sepcifed HostName to an IP address. It provides you with an option to perform the resolution yourself, obtain the IP address from an internal cache you're maintaing, or do some other processing (such as for example chaging the hostname to look up).

 

event OnResolveHostName: EventHandler<ResolveHostNameEventArgs>

 

delegate EventHandler<ResolveHostNameEventArgs> OnResolveHostName()

 

__event EventHandler<ResolveHostNameEventArgs>: OnResolveHostName!

 

Event OnResolveHostName As EventHandler<ResolveHostNameEventArgs>