Connecting to a User Directory

LDAP Configuration Reference

Access LDAP configuration settings from the Global Menu (Applications Menu icon):

  • Control Panel → Configuration → Instance Settings → Security → LDAP
  • Control Panel → Configuration → System Settings → Security → LDAP

The LDAP configuration includes the following sections: General, Servers, Connection, Export, and Import.

General

FieldDescription
EnabledActivates LDAP authentication.
RequiredRequires users to authenticate through LDAP. When unchecked, users can log in using Liferay credentials.
Use LDAP Password PolicyUses the LDAP server’s password policy.
MethodDefines the authentication method (Bind or Password Compare).
Password Encryption AlgorithmDefines the encryption algorithm used with Password Compare.
Note

Liferay applies its own password policy to users who have never authenticated through LDAP when the following conditions are met:

  • Enabled is checked
  • Required is unchecked
  • Use LDAP Password Policy is checked

The General configuration tab.

Servers

Click Add to add an LDAP server.

Adding a new LDAP server requires only a few options to be defined.

Once you’ve finished configuring LDAP, click Save.

Tip

Use the test options to validate your configuration. Test LDAP Connection checks connectivity and credentials, while Test LDAP Users and Test LDAP Groups verify user and group search filters.

Basic Settings

FieldDescriptionExample
Server NameIdentifies the LDAP server.ApacheDS, ActiveDirectory
Clock SkewDefines the allowed time difference (in milliseconds) between Liferay and the LDAP server for validating users’ modified timestamps during import.3000

Default Values

Loads predefined configuration values for supported directory servers:

  • Apache Directory Server
  • Fedora Directory Server
  • Microsoft Active Directory Server
  • Novell eDirectory
  • OpenLDAP
  • Other Directory Server

Connection

FieldDescriptionExample
Base Provider URLSpecifies the LDAP server URL.ldap://localhost:10389 (ApacheDS), ldap://localhost:389 (Active Directory)
Base DNDefines the base distinguished name used for directory searches.dc=example,dc=com, dc=localdomain
PrincipalSets the LDAP administrator user.uid=admin,ou=system (ApacheDS), cn=Directory Manager (Fedora), admin (AD)
CredentialsSets the password for the LDAP administrator.

Users

FieldDescriptionExample
Authentication Search FilterDefines how Liferay identifies a user during login.(mail=@email_address@) (ApacheDS/OpenLDAP), (&(objectCategory=person)(sAMAccountName=@user_id@)) (AD)
Import Search FilterDefines which LDAP entries are imported as users.(objectClass=person), (objectClass=inetOrgPerson)
Ignore User Search Filter for AuthenticationIgnores the authentication filter during login validation.

User Mapping

FieldDescription
UUIDMaps the unique identifier.
Screen NameMaps the user’s screen name.
Email AddressMaps the user’s email.
PasswordMaps the password attribute.
First NameMaps the first name.
Middle NameMaps the middle name.
Last NameMaps the last name.
Full NameMaps the full name.
Job TitleMaps the job title.
StatusMaps the user’s status.
GroupMaps group membership.

Custom Mapping

FieldDescriptionExample
Custom User MappingMaps LDAP attributes to custom user fields.employeeNumber=customField1
Custom Contact MappingMaps LDAP attributes to custom contact fields.department=contactField1

User Ignore Attributes

FieldDescriptionExample
User Ignore AttributesDefines Liferay user attributes LDAP does not overwrite.birthday

Groups

FieldDescriptionExample
Import Search FilterDefines which LDAP entries are imported as groups.(objectClass=groupOfUniqueNames), (objectClass=group) (AD)

Group Mapping

FieldDescriptionExample
Group NameMaps the group name.cn
DescriptionMaps the group description.description, sAMAccountName (AD)
UserMaps the membership attribute.uniqueMember, member (AD)

Export

FieldDescriptionExample
Users DNDefines where users are stored in LDAP.dc=example,dc=com
User Default Object ClassesDefines object classes for exported users.top,person,inetOrgPerson,organizationalPerson
Groups DNDefines where groups are stored in LDAP.dc=example,dc=com
Group Default Object ClassesDefines object classes for exported groups.top,groupOfUniqueNames

Connection

The Connection settings include error keyword properties used to interpret LDAP server responses. When a user binds to LDAP, the server returns messages describing success or failure. Because these messages vary by server, configure these keywords to match your directory’s error messages so Liferay can recognize them.

General Settings

FieldDescription
Factory InitialSpecifies the initial context factory. Default: com.sun.jndi.ldap.LdapCtxFactory.
ReferralDefines how referrals are handled: Follow (automatically follows referrals), Ignore (ignores referrals), or Throw (throws a ReferralException for each referral).
Page SizeSets the number of results per page for directory servers that support paging. Must be 1000 or less for Microsoft Active Directory.
Range SizeSets the number of values returned for multi-valued attributes for servers that support range retrieval. The maximum value depends on the directory server.

Connection Properties

PropertyDescription
com.sun.jndi.ldap.connect.poolEnables connection pooling when creating LDAP connections.
com.sun.jndi.ldap.connect.timeoutSets the connection timeout in milliseconds.
com.sun.jndi.ldap.read.timeoutSets the read timeout in milliseconds for LDAP operations.

Error Handling Keywords

Define keywords used to interpret LDAP error messages. If your directory server returns different messages, update these values to match.

FieldDescriptionExample
Error Password Expired KeywordsMatches password expiration messages.expired
Error Password History KeywordsMatches password history messages.history
Error User Lockout KeywordsMatches account lockout messages.retry limit

Export

FieldDescription
Enable ExportExports user updates to LDAP.
Enable Group ExportExports groups to LDAP. Requires Enable Export.

When export is enabled, user updates trigger LDAP exports. Because fields such as lastLoginDate are updated on login, an export can occur each time a user logs in.

To prevent this, set users.update.last.login=false in portal-ext.properties.

The Export tab.

Import

FieldDescription
Enable ImportImports users from LDAP. If disabled, users are imported when they log in.
Enable Import on StartupRuns a full import when the server starts. Disable in clustered environments to avoid repeated imports.
Import IntervalDefines how often imports run.
Import MethodDefines whether to import by User or Group.
Lock Expiration TimeDefines account lock duration (ms).
Import User Sync StrategyDefines how users are matched (Auth Type or UUID).
Enable User Password on ImportAssigns passwords during import.
Autogenerate User Password on ImportGenerates random passwords.
Default User PasswordSets a default password. Used when password generation is disabled.
Enable Group Cache on ImportCaches group data.
Create Role per Group on ImportCreates a role for each LDAP group.
Note

The LDAP authentication process does not depend on the import method. When users authenticate, they are imported as though the User import method had been selected.

Note

When using the Group import method, users who do not belong to any groups are not imported.

The Import screen contains the above options.

LDAP Options Available in System Settings

Most LDAP configuration is done in Instance Settings. System Settings include additional options and define default values for new virtual instances.

Note

Changes in System Settings apply to the current instance. New instances inherit these settings as defaults.

To modify these options, go to Control PanelConfigurationSystem Settings, then open the LDAP entries under Security. Additional settings are available in the Servers entry.