User Guide

Table Of Contents
Implementing user security 401
</cfif>
</cflogin>
Reviewing the code
The following table describes the code and its function. Comments and some tab characters have
been removed for brevity.
Code Description
<cflogin>
<cfif isDefined("cflogin")>
<!--- setting basic attributes --->
<cfset LDAP_root = "o=mycompany.com">
<cfset LDAP_server =
"ldap.mycompany.com">
<cfset LDAP_port = "389">
<cfset userPrefix = "cn=">
<cfset userSuffix =
",ou=Users,o=mycompany.com">
<cfset LDAP_username =
userPrefix&cflogin.name&userSuffix>
<cfset userfilter =
"(&(objectClass=groupOfUniqueNames)
(uniqueMember=#LDAP_username#))">
Starts the cflogin tag body. Sets several
variables to the values used as attributes in the
cfldap tag.
Sets prefix and suffix values used to create a
distinquished name (dn) for binding to the
LDAP server.
Creates the user’s bind dn by concatenating
the prefix and suffix with cflogin.name. This
variable is used for authenticating the user to
the LDAP server.
Sets the filter used to search the directory and
retrieve the user’s group memberships. The
group membership represents the user’s roles
within the organization.
<cftry>
<cfldap action="QUERY"
name="auth"
attributes="cn"
referral="yes"
start="#LDAP_root#"
scope="SUBTREE"
server="#LDAP_server#"
port="#LDAP_port#"
filter="#userfilter#"
username="#LDAP_username#"
password="#cflogin.password#"
>
In a cftry block, uses the user’s concatenated
dn to authenticate to the LDAP server and
retrieve the common name (cn) attribute for
groups to which the user is a member. If the
authentication fails the LDAP server returns an
error.
Note: The LDAP permissions must allow an
authenticated user to read and search groups
in order for the query to return results.