18 July, 2012

Custom LDAP attributes import

Hi Everyone,
If you want to import LDAP extra attributes in liferay , then you can achive this functionality two different ways :

1) If you are using LR 6.X then you can directly map your custom field attribute with LDAP by setting below property in portal-ext.properties file :


Here phone and address will be key of custom attributes which can be created from control panel.
So in this case you dont need to change any code.Please see below screen

For other LDAP import export you can check  http://www.liferaysolution.com/2012/07/ldap-import-export.html

2) if you want use existing liferay fields phone number and address then you may have to map these new fieldsin portal-ext.properties like :


Here addressLDAP & phoneLDAP will be attributes of your LDAP schema and you can access this value in PortalLDAPImporterUtil class (importFromLDAP method).
So you may have to override this class and
Here you can get this value using : GetterUtil.getString(userMappings.getProperty("addres")).toLowerCase()

Rate Me:


  1. Its a simple and nice blog Jignesh

  2. hye.. I want to ask you something regarding liferay LDAP. I hope you don't mind spend your time on my question. :)

    I already can import liferay user into open ldap. but cannot export open ldap user into liferay.
    i already follow the tutorial. Some tutorial said we have to configure using control panel, but some totorial said not (because we have to configure using portal-ext.properties). I already follow both tutorial. but nothing happened.
    It said that we have to change package package com.liferay.portal.security.ldap in class PortalLDAPImporterImpl , but I could not find this file.
    So, I try to edit edit_ldap_server.jsp and test_ldap_user.jsp file. I add phone text field.Then, I call mobile attribute at LDAP server. The column for phone number exist and it display the value. but still, nothing happened when I edit the phone column in liferay. I create phone at liferay user using your tutorial.

  3. thanks man, this is what i was searching for since last 30minutes.


  4. Hi Jignesh, Thank you for this one.

    Few questions,

    1. You have mentioned ( and few other places on net I found )ldap.user.custom.mappings.0=, How you decide on 0 ? As I have already mapped my LDAP to my Liferay instance, and in database portalpreferences table it's ldap.user.mappings.12301. So in portal-ext.properties what should I use ?

    2. I have already mapped LDAP and can login using LDAP username/password. But I want map UUID to a custom field of LDAP so that when user has forgotten username/password they can click reset it using UUID number. And that number is unique in LDAP. In worst case Can I assign that LDAP number to userId ?

    3. I have added a custom field for USER object but I cant see the customfield into the liferay's user_ database table ? why ?

    Thank you


Your Comments on this post

Re:(4) Do you want a million for the New Year?

To unsubscribe, send us an email with the subject 'unsubscribe' qiWv qiWv Do you want a million for the New Year? qiWv qiWv ...