Provides an interface to a Lightweight Directory Access Protocol
(LDAP) directory server, such as the Netscape Directory Server.
<cfldap server="">
cfldap(server="");
389
query
query
add
modify
modifyDN
delete
60000
onelevel
onelevel
base
subtree
asc
nocase
asc
desc
nocase, desc
nocase, asc
replace
add
delete
replace
false
true
false
CFSSL_BASIC
,
;
false
Queries the debian developer LDAP server and returns users with a surname of Smith
<cfldap server="db.debian.org"
action="query"
name="results"
start="dc=debian,dc=org"
filter="sn=Smith"
attributes="cn,sn,givenName,mail,st,l,ou">
<cfdump var="#results#">
This example gets the user's data from active directory and displays a thumbnail image stored in active directory.
<cfldap
server="ServerName"
port=636
action="QUERY"
name="qLDAP"
secure="CFSSL_BASIC"
username="mydomain\#encodeForLDAP(ldapUsername)#"
password="#ldapPassword#"
start="dc=MYDOMAIN,dc=MYTLD"
attributes="cn,userPrincipalName,title,mail,thumbnailPhoto"
filter="(sAMAccountName=#encodeForLDAP(username)#)">
<cfoutput><img src="data:image/jpeg;base64,#binaryEncode(qLDAP.thumbnailPhoto,"Base64")#" /></cfoutput>
This is an example of using cfldap
to authenticate a user against an Active Directory server. The server or domain CA certificate must be imported into the cacerts java keystore for security="CFSSL_BASIC"
to work.
cfldap(
server = "ServerName",
port = 636,
action = "QUERY",
name = "qLDAPLookup",
secure = "CFSSL_BASIC",
username = "MYDOMAIN\#encodeForLDAP(arguments.username)#",
password = arguments.password,
start = "dc=MYDOMAIN,dc=MYTLD",
attributes = "cn,userPrincipalName,title,mail",
timeout = "10",
filter = "(sAMAccountName=#encodeForLDAP(arguments.username)#)"
);
if (qLDAPLookup.recordCount) {
userAuthenticated = true;
}
Signup for cfbreak
to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.