从ldap服务器导入的liferay用户的身份验证失败

时间:2015-04-16 07:13:21

标签: ldap liferay liferay-6 liferay-ide

根据我的要求,我需要使用从ldap服务器导入的用户登录liferay。我将逐步解释该方案

1)I have some java code to create a user into Ldap server(name,firstname,password etc)
2)User has been created successfully in ldap server 
3)I gave some properties in portal-ext.properties files to import these users from ldap server to liferay and to login using the screen name
4)From the control panel i could see that the user has been imported to liferay 
5)Now if i try to login with the screenname and the password (password i passed in step1)it shows authentication failed
6)I Logged into liferay as administrator and changed the password of the user
7)Now the login is successfull

问题

1) How can i properly import the password from ldap server to liferay.
2)Any idea why the password i gave shows authentication failure

Portal-ext.properties

#jdbc.default.jndi.name=jdbc/LiferayPool
jdbc.default.driverClassName=com.mysql.jdbc.Driver
jdbc.default.url=jdbc:mysql://localhost/lportal?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
jdbc.default.username=root
jdbc.default.password=root


json.service.auth.token.hosts.allowed=127.0.0.1
json.service.auth.token.enabled=false
jsonws.web.service.public.methods=*
jsonws.servlet.hosts.allowed=127.0.0.1

users.screen.name.validator=com.liferay.portal.security.auth.LiberalScreenNameValidator
#users.screen.name.allow.numeric=true
#users.screen.name.validator=com.liferay.portal.security.auth.DefaultScreenNameValidator

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=false
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


users.screen.name.allow.numeric=true
#ldap.auth.method=bind
#ldap.auth.password.encryption.algorithm=
#passwords.encrypted=


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

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

#ldap.user.impl=com.liferay.portal.security.ldap.LDAPUser

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=(mail=@email_address@)
ldap.auth.search.filter=(cn=@screen_name@)

ldap.import.user.password.enabled=true

#ldap.import.create.role.per.group=true


axis.servlet.hosts.allowed=
axis.servlet.https.required=false
#company.security.auth.type=emailAddress
company.security.auth.type=screenName
search.container.show.pagination.top=false
setup.wizard.enabled=false
passwords.default.policy.change.required=false

我使用Liferay 6.2 GA2捆绑Tomcat 7和OpenDJ-2.5.0-Xpress。有人可以帮我解决这个问题

3 个答案:

答案 0 :(得分:1)

可能存在某些可能性:

  1. 密码是否遵循您在Portal中隐含的相同密码策略和加密技术?
  2. 是否为用户分配了正确的组织/站点/角色?

答案 1 :(得分:1)

portal-ext.properties

中尝试以下LDAP属性
# LDAP id 1 is for open LDAP instance
ldap.server.ids=1

ldap.referral.1=follow
ldap.factory.initial.1=com.sun.jndi.ldap.LdapCtxFactory
ldap.server.name.1=ldaptest-internal
ldap.base.provider.url.1=ldap://<host>:<port>
ldap.base.dn.1=dc=example,dc=com

ldap.security.principal.1=cn=Manager,dc=example,dc=com
ldap.security.credentials.1=seacret

ldap.auth.search.filter.1=(mail=@email_address@)

# EXPORT RELATED PROPERTY
ldap.user.default.object.classes.1=top,person,organizationalPerson,inetOrgPerson

#User mappings
#
ldap.user.mappings.1=screenName=uid\npassword=userPassword\nemailAddress=mail\nfirstName=givenName\nlastName=sn\ngroup=groupMembership\nfullName=cn


# EXPORT RELATED PROPERTY
ldap.group.default.object.classes.1=top,groupOfUniqueNames

# Group mappings
#
ldap.group.mappings.1=groupName=cn\ndescription=description\nuser=uniqueMember

# Import and export search filter
#
ldap.import.user.search.filter.1=(objectClass=inetOrgPerson)
ldap.import.group.search.filter.1=(objectClass=groupOfUniqueNames)


# EXPORT RELATED PROPERTY
ldap.users.dn.1=dc=example,dc=com

# EXPORT RELATED PROPERTY
ldap.groups.dn.1=dc=example,dc=com

auth.pipeline.pre.1=com.liferay.portal.security.auth.LDAPAuth
ldap.import.method.1=user


ldap.import.enabled=true
ldap.import.on.startup=true
ldap.auth.enabled=true
ldap.auth.required=true
ldap.password.policy.enabled=true

我猜可能会遗漏一些财产。

答案 2 :(得分:0)

正如我在我的问题中所说的,我使用一些java代码在ldap中创建用户,并且我将密码绑定到ldap的userPassword字段。所以这些是我为修复问题所做的更改

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

ldap.auth.search.filter=(uid=@screen_name@)
ldap.import.user.password.enabled=false
ldap.import.user.password.autogenerated=false
ldap.import.user.password.default=userPassword