openLDAP安装文件openldap-2.2.29-db-4.3.29-openssl-0.9.8a-win32_Setup.exe
liferay配置如下:
ldap.import.enabled=true
ldap.import.on.startup=true
ldap.import.interval=10
ldap.import.method=user
ldap.import.factory.initial=com.sun.jndi.ldap.LdapCtxFactory
ldap.import.base.provider.url=ldap://192.168.10.164:389
ldap.import.base.dn=dc=syntong,dc=com
ldap.import.security.principal=cn=manager,dc=syntong,dc=com
ldap.import.security.credentials=111111
ldap.auth.password.encryption.algorithm.types=MD5,SHA
ldap.import.user.search.filter=(objectClass=inetOrgPerson)
表示检索objectClass=inetOrgPerson 的用户,都同步到liferay的表里面
cas的配置在前一篇已经说明,在此只需要修改deployerConfigContext_ldap.xml文件
将数据库验证修改为ldap验证
修改liferay的UserLocalServiceImpl.java 的1442行,
原来的if (userIdValidator != null) {
if (!userIdValidator.validate(userId, companyId)) {
throw new UserIdException();
}
}
修改为:
if ((userIdValidator != null)&&(!isNumeric(userId))) {
if (!userIdValidator.validate(userId, companyId)) {
throw new UserIdException();
}
}
public static boolean isNumeric(String str){
Pattern pattern = Pattern.compile("[0-9]*");
return pattern.matcher(str).matches();
}
解决cn为数字的时候同步失败的问题。
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/15874680/viewspace-555691/ ,如需转载,请注明出处,否则将追究法律责任。