Legacy Knowledge Base
Published Jul. 2, 2025

Importing Contact and Custom Field Mappings From LDAP

Written By

Michael Wine

How To articles are not official guidelines or officially supporteddocumentation. They are community-contributed content and may not alwaysreflect the latest updates to Liferay DXP. We welcome your feedback toimprove How to articles!

While we make every effort to ensure this Knowledge Base is accurate, itmay not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with anyfeedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack"publication program, made available for informational purposes. Articlesin this program were published without a requirement for independentediting or verification and are provided "as is" withoutguarantee.

Before using any information from this article, independently verify itssuitability for your situation and project.

In some environments it may be desirable to import a user's contact information from an LDAP server. This article explains how to import custom mappings as well as contact mappings from a Microsoft Active Directory LDAP server using the following properties:

ldap.contact.mappings.0=

ldap.user.custom.mappings.0=

**In this article, the properties which end with .0 indicate that they are set for the LDAP server called 0. You can set up several LDAP servers in the portal-ext, and this part indicates which server the properties belong to.

Quick Example:

ldap.server.ids=0,1
ldap.server.name.0=Win2008-Server
ldap.server.name.1=ApacheDS

Please note that in order to use this functionality, the portal must connect to LDAP via the portal-ext.properties file. Once the connection is made through the Control Panel GUI, the connection values are written to the database which overrides the portal-ext in precedence.

Resolution

Before starting the Liferay Instance with LDAP:

  1. Include the following LDAP properties in the portal-ext.properties file:

    (Note that the connection mappings might be different for each setup.)

    ldap.auth.enabled=true
    	ldap.import.enabled=true
    	ldap.import.on.startup=false
    	ldap.base.provider.url.0=ldap://LDAP_IP_ADDRESS:389
    	ldap.base.dn.0=dc=windows2008r2,dc=ntlm
    	ldap.security.principal.0=cn=Administrator,cn=Users,dc=windows2008r2,dc=ntlm
    	ldap.security.credentials.0=liferay
    	ldap.auth.search.filter.0=(sAMAccountName=@screen_name@)
    	ldap.import.user.search.filter.0=(objectClass=person)
    	ldap.user.mappings.0=screenName=sAMAccountName\npassword=userPassword\nemailAddress=mail\nfullName=cn\nmiddleName=middleName\nfirstName=givenName\nlastName=sn\ngroup=memberOf
    	ldap.import.group.search.filter.0=(objectClass=group)
    	ldap.group.mappings.0=groupName=cn\ndescription=sAMAccountName\nuser=member
    	ldap.contact.custom.mappings.0=ldap.contact.mappings.0=skypeSn=employeeTypeldap.user.custom.mappings.0=Telephone=telephoneNumber
    

    The two properties in bold are pointing to the contact and custom field mappings.

  2. Start the portal and log in as the admin user
  3. Go to Control Panel > Authentication > LDAP. Check the Enabled check box and click save.
  4. In the Control Panel > Authentication page, set the drop down menu to allow users to authenticate by screen name.
  5. Navigate to the LDAP server.
  6. Open the directory in a LDAP text editor.
  7. Create a user named TEST_USER. Be sure to give the user all the appropriate information to allow him to be imported:

    First Name, Last Name, Password, Email Address, Screen Name

  8. Open the user's properties and find the field called 'employeeType.' Click edit and set the value to 'Joe Bloggs.' Click Save.
  9. Now, scroll down to the 'telephoneNumber' field. Edit this field and set the value to '5555555555.'
  10. In the Liferay Portal, go to Control Panel > Custom Fields > User > Add New Field. Fill in the name Telephone and make sure Text Box is selected in the drop-down menu.
  11. Click the new field. Adjust the height to 100 and the width to 200 so that the test box will be visible. Click Save.
  12. Now sign out as the admin user and sign in as TEST_USER with the password. The user will be imported. Once he is fully signed in, sign out.
  13. Sign back in as the admin user and go to Control Panel > Users and Organizations. Click on TEST_USER.
  14. Go to the Custom Field tab in the right hand menu towards the bottom. Verify that the telephone number has been imported.
  15. Now, in the right had menu towards the middle, go to the Instant Messenger tab. 'Joe Bloggs' appears in the Skype field.

Additional Information

For a list of contact attributes to use, see com.liferay.portal.model.ContactModel

Note: While this article used the ldap.contact.mappings.0=skypeSn=employeeType, any LDAP mapping that is empty could be used in place of 'employeeType.'

Did this article resolve your issue ?

Legacy Knowledge Base