Search code examples
ldapliferayliferay-6portalliferay-ide

Unable to load user from Ldap server in to Liferay com.liferay


Im trying authenticate users from ldap server to liferay.My requirement is to login to liferay using screename .

ldap.base.provider.url= ldap://localhost:389
ldap.base.dn= dc=soas,dc=schoolx
ldap.security.principal= cn=admin
ldap.security.credentials= blahblah
auth.pipeline.pre=com.liferay.portal.security.auth.LDAPAuth

ldap.auth.enabled=true
ldap.auth.required=true
ldap.password.policy.enabled=true
ldap.users.dn= dc=soas,dc=schoolx
ldap.groups.dn= dc=soas,dc=schoolx

ldap.import.enabled=true
ldap.import.interval=1
ldap.import.on.startup=true

ldap.import.method=group
ldap.import.group.search.filter.enabled=true
ldap.import.group.cache.enabled=false
#ldap.export.enabled=true

ldap.auth.password.encryption.algorithm=

ldap.user.mappings=screenName=cn\npassword=userPassword\nemailAddress=mail\nfirstName=givenName\nlastName=sn

ldap.group.mappings=groupName=cn\ndescription=description\nuser=member

ldap.import.user.search.filter=(objectClass=inetOrgPerson)

ldap.import.group.search.filter=(objectClass=groupOfEntries)

ldap.auth.search.filter=(cn=@screen_name@)

When i login using a user from ldap server i get the following exception.

07:20:28,513 ERROR [liferay/scheduler_dispatch-2][PortalLDAPImporterImpl:1061] Unable to load user {createtimestamp=createTimestamp: 20150331045703Z, mail=mail: [email protected], userpassword=userPassword: [B@6c01fb, creatorsname=creatorsName: cn=Directory Manager,cn=Root DNs,cn=config, givenname=givenName: vimekedited, sn=sn: vanamali, cn=cn: vimekeditedmali}
com.liferay.portal.GroupFriendlyURLException
    at com.liferay.portal.service.impl.UserLocalServiceImpl.validateScreenName(UserLocalServiceImpl.java:6181)
    at com.liferay.portal.service.impl.UserLocalServiceImpl.validate(UserLocalServiceImpl.java:5897)
    at com.liferay.portal.service.impl.UserLocalServiceImpl.addUserWithWorkflow(UserLocalServiceImpl.java:746)
    at com.liferay.portal.service.impl.UserLocalServiceImpl.addUser(UserLocalServiceImpl.java:608)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:115)
    at com.liferay.portal.spring.transaction.DefaultTransactionExecutor.execute(DefaultTransactionExecutor.java:62)
    at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:51)
    at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
    at com.liferay.portal.spring.aop.ServiceBeanAopProxy.invoke(ServiceBeanAopProxy.java:175)
    at com.sun.proxy.$Proxy105.addUser(Unknown Source)
    at com.liferay.portal.service.UserLocalServiceUtil.addUser(UserLocalServiceUtil.java:1166)
    at com.liferay.portal.security.ldap.PortalLDAPImporterImpl.addUser(PortalLDAPImporterImpl.java:521)
    at com.liferay.portal.security.ldap.PortalLDAPImporterImpl.importUser(PortalLDAPImporterImpl.java:930)
    at com.liferay.portal.security.ldap.PortalLDAPImporterImpl.importUsers(PortalLDAPImporterImpl.java:1042)
    at com.liferay.portal.security.ldap.PortalLDAPImporterImpl.importFromLDAPByGroup(PortalLDAPImporterImpl.java:664)
    at com.liferay.portal.security.ldap.PortalLDAPImporterImpl.importFromLDAP(PortalLDAPImporterImpl.java:197)

enter image description here

Can some one help me to fix this issue?


Solution

  • Liferay creates a private group for every user with their screenname as unique friendly URL. I guess here the issue is that there is already an existed group with friendly URL same as user's screenname. So, liferay unable to import this user to its database.

    In liferay database, try to execute this query and see if it return any group.

    select groupId, name, friendlyURL from Group_ where friendlyURL like '%vimekeditedmali%';
    

    If this returns any existed group, then you need to change friendly URL of this group for import user to work.