Search code examples
javaactive-directoryldapliferayliferay-6

Liferay portal-ext LDAP configuration


For the first time i configured the LDAP connection i did it through the Liferay control panel and everything worked just fine. But now i want to configure it through portal-ext.properties file, these are my configurations:

ldap.auth.enabled=true
ldap.import.enabled=true
ldap.import.on.startup=true
ldap.import.method=user
ldap.auth.required=true
ldap.export.enabled=false

ldap.base.provider.url=ldap://********************
ldap.base.dn=********************
ldap.security.principal=********************
ldap.security.credentials=********************

ldap.user.mappings.0=uuid=\nscreenName=sAMAccountName\npassword=userPassword\nemailAddress=mail\nfirstName=givenName\nlastName=sN\njobTitle=\ngroup=memberOf\n
ldap.auth.search.filter.0=(sAMAccountName=@screen_name@)

ldap.import.user.search.filter.0=(objectClass=person)
ldap.import.group.search.filter.0=(objectClass=group)
ldap.group.mappings.0=groupName=cn\ndescription=description\nuser=uniqueMember
ldap.user.custom.mappings.0=
ldap.contact.mappings.0=
ldap.contact.custom.mappings.0=

Besides this, everytime i change some configuration i clean the database just to be sure that the file is properly read.

When i run the server and go to the LDAP authentication in the control panel all the configurations are exactly as i configured in the portal-ext file (even the Test LDAP Connection is working fine) but the Users configurations are empty. Can you explain why i'm having this problem?


Solution

  • I found out what was the problem! I just removed the server id from all configurations and now the fields in control panel are finally filled.

    These are the correct ldap configurations:

    ldap.auth.enabled=true
    ldap.import.enabled=true
    ldap.import.on.startup=true
    ldap.import.method=user
    ldap.auth.required=true
    ldap.export.enabled=false
    
    ldap.base.provider.url=ldap://********************
    ldap.base.dn=********************
    ldap.security.principal=********************
    ldap.security.credentials=********************
    
    ldap.user.mappings=uuid=\nscreenName=sAMAccountName\npassword=userPassword\nemailAddress=mail\nfirstName=givenName\nlastName=sN\njobTitle=\ngroup=memberOf\n
    ldap.auth.search.filter=(sAMAccountName=@screen_name@)
    
    ldap.import.user.search.filter=(objectClass=person)
    ldap.import.group.search.filter=(objectClass=group)
    ldap.group.mappings=groupName=cn\ndescription=description\nuser=uniqueMember
    ldap.user.custom.mappings=
    ldap.contact.mappings=
    ldap.contact.custom.mappings=
    

    Another way to make it work is to add the server id in the connection configurations just like this:

    ldap.auth.enabled=true
    ldap.import.enabled=true
    ldap.import.on.startup=true
    ldap.import.method=user
    ldap.auth.required=true
    ldap.export.enabled=false
    
    ldap.base.provider.url.0=ldap://********************
    ldap.base.dn.0=********************
    ldap.security.principal.0=********************
    ldap.security.credentials.0=********************
    
    ldap.user.mappings.0=uuid=\nscreenName=sAMAccountName\npassword=userPassword\nemailAddress=mail\nfirstName=givenName\nlastName=sN\njobTitle=\ngroup=memberOf\n
    ldap.auth.search.filter.0=(sAMAccountName=@screen_name@)
    
    ldap.import.user.search.filter.0=(objectClass=person)
    ldap.import.group.search.filter.0=(objectClass=group)
    ldap.group.mappings.0=groupName=cn\ndescription=description\nuser=uniqueMember
    ldap.user.custom.mappings.0=
    ldap.contact.mappings.0=
    ldap.contact.custom.mappings.0=