LDAPClient Data Type

Official Content
This documentation is valid for:

LDAPClient data type is a GeneXus type that allows connecting to LDAP servers. It can be used to authenticate users or retrieve attributes under a specified context.

Properties

LDAP AuthenticationMethod Property
Host Property
Password Property
Port Property
User Property
LDAP Secure Property

Methods

Connect Method
Disconnect Method
GetAttribute

Connect

Creates the connection to the LDAP server at the specified host and port, using the specified authentication method. Optionally if the user and password are specified, they will be used to create the connection.

Syntax

&ret = &LDAPCliente.Connect()

Returned Values

Numeric: 1 means it successfully connected, 0 means it could not connect to the server.

Example

&ldapClient.Host = 'myServer' 
&ldapClient.Port = 389 
&ldapClient.AuthenticationMethod = 'simple' 
&ldapClient.User = 'myUser' 
&ldapClient.Password = 'myPassword' 
&ret = &ldapClient.Connect()

Disconnect

Terminates the connection with the server.

Syntax

&LDAPClient.DisConnect()

GetAttribute

Through this method, the queues to the LDAP directory are achieved. It returns the values of the AttName attribute, which is defined by the context (related to the domain or one of its branches) and fulfills the filters set by Properties.

Syntax

&LDAPClient.GetAttribute( AttName, context, properties )

Where:
AttName
Is the name of the attribute

context
Is a string

properties
Properties data type.

Returns the values of the "AttName" attribute defined by a context and a set of attributes.

Example

&MatchAtts -> Properties data type

&MatchAtts .set("uid", "John") 
for &auxString in &ldapClient.GetAttribute("mail", "ou=People, o=myserver", &MatchAtts) 
   msg(&auxString) 
endfor

See Properties Data Type.

Considerations

  • Java: Information about SASL Authentication: http://java.sun.com/products/jndi/tutorial/ldap/security/sasl.html.
  • Java: For information about LDAP Authentication, see: http://java.sun.com/products/jndi/tutorial/ldap/security/auth.html
  • Java: To use the LDAPClient data type in Java, Sun Virtual Machine must be used.
  • Java: Microsoft Virtual Machine does not have native support for it. However, it is possible to use LDAPClient (*just authenticate users) with Microsoft VM, if JNDI 1.1.2 is downloaded (JNDI 1.1.2 Class Libraries, LDAP Service Provider, 1.0.3) (http://java.sun.com/products/jndi/downloads/index.html). After that, jndi.jar, ldap.jar, providerutil.jar must be added to the classpath. When using Microsoft VM, it is possible to authenticate users but it is not possible to retrieve attributes.
  • When specifying a context (when retrieving attributes, for example) it is important to take into account that contexts are different depending on the directory tree structure and depending on the LDAP. For example, when using Netscape Server a possible context could be:

    uid = John, ou = People, dc = myCompany, dc = com

    When using Active Directory an example could be:

    cn = John, ou = Users , dc = myCompany, dc = com

    So it is very important to know that the context being used matches the server's directory tree structure in order to get correct results.

Scope

Objects Procedure object, Transaction object, Web Panel object
Interfaces Web