`
seawavecau
  • 浏览: 755382 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

Liferay下LDAP的配置

阅读更多

LDAP

From LiferayPedia

Jump to: navigation, search
<!---->

This page seeks to explain LDAP's use in Liferay.

Contents

[hide]
<script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>

Features

Authentication

The LDAP class that handles the connection and search of LDAP is LDAPAuth. LDAPUtil is used to help grab attributes.

In portal.properties, LDAP is part of the authentication pipline:

auth.pipeline.pre=com.liferay.portal.security.auth.LDAPAuth

You can set default values in portal.properties as well:

   #
   # LDAPAuth can be configured from the Admin portlet. It provides out of the
   # box support for Apache Directory Server, Microsoft Active Directory
   # Server, Novell eDirectory, and OpenLDAP. The default settings are for
   # Apache Directory Server.
   #
   auth.impl.ldap.enabled=false
   auth.impl.ldap.required=false
   auth.impl.ldap.factory.initial=com.sun.jndi.ldap.LdapCtxFactory
   auth.impl.ldap.provider.url=ldap://localhost:10389/dc=example,dc=com
   auth.impl.ldap.security.principal=uid=admin,ou=system
   auth.impl.ldap.security.credentials=secret
   auth.impl.ldap.search.filter=(mail=@email_address@)
   auth.impl.ldap.user.mappings=userId=cn\npassword=userPassword\nemailAddress=mail\nfirstName=givenName\nlastName=sn\njobTitle=title

Import

...

Export

...

Password Policy

...

Import (Available since Liferay Portal 4.2)

LDAP Import Settings

Liferay Portal can be configured to periodically check an LDAP server and add any new user accounts to the portal database. The importer is able to:

  • Find new users in LDAP and add them to the portal copying the appropriate information
  • Update the information about existing users
  • Detect membership of users through groups by using a configurable attribute. LDAP groups are mapped to portal "user groups" and are created if they do not exist already

This feature is highly configurable. It is possible to define an LDAP search filter to limit which user accounts will be imported and to define the mapping of LDAP attribute names to portal profile names.

    ldap.import.enabled=true
    ldap.import.on.startup=true
    ldap.import.interval=10
    ldap.import.method=user (or group)

LDAP Import Details

Liferay can import LDAP users and LDAP groups at 3 different times

  1. Single user import on login (required)
  2. Mass import on startup (optional)
  3. Mass import on interval (optional)
  • If LDAP authentication has been set, user's are automatically imported when a user logs in with LDAP credentials
  • LDAP servers can maintains group membership in 2 different ways, via the User and/or the Group.
    • LDAP Server may add attributes (most commonly the groupMembership attribute) in the user entry, specifying all the groups that the user is a member of
    • LDAP Server may add attributes (most commonly the uniqueMember attribute) in the group entry, specifying all the users that are members of the group
  • You only need to deal with this when doing a mass import. To work with this, you will need to set another property, ldap.import.method. If you see uniqueMember attributes in the LDAP groups, set ldap.import.method=group, otherwise set ldap.import.method=user. If set to group, Liferay will loop through all the groups, and import the users and membership that are related to each group. This means that if a user is not part of any group, that user will not be imported during a mass import. The opposite is true if set to user, groups that arent referenced by any user will not be imported.
  • As of Liferay Portal 4.2, importing only happened via the user.
  • As of Liferay Portal 4.3.1, you now have the 'ldap.import.method property since Liferay can handle both methods of import
  • What gets imported? When importing users, Liferay searches all entries that match the following search filter. ldap.import.user.search.filter=(objectClass=inetOrgPerson) and for importing groups, Liferay searches according to the following filter: ldap.import.group.search.filter=(objectClass=groupOfUniqueNames).
  • Importing too much? If you want to limit what users or groups are imported, you can set ldap.users.dn=ou=users,dc=example,dc=com and ldap.groups.dn=ou=groups,dc=example,dc=com as the base.. then only users and groups under these DN's will be imported


Export (Available since Liferay Portal 4.3)

LDAP Export Settings

The following properties are used in LDAP export

    ldap.export.enabled=true
    ldap.users.dn=ou=users,dc=example,dc=com
    ldap.user.mappings=screenName=cn\npassword=userPassword\nemailAddress=mail\nfirstName=givenName\nlastName=sn\njobTitle=title\ngroup=groupMembership
    ldap.user.impl=com.liferay.portal.security.ldap.LDAPUser
    ldap.user.default.object.classes=top,person,inetOrgPerson,organizationalPerson

LDAP Export Details

  • If ldap.export.enabled=true, Liferay uses a listener to track any changes made to the User object and will push these changes out to the LDAP server whenever the User object is updated.
  • If the user already exists in ldap.users.dn, they will be updated, otherwise a new user will be created.
  • Newly created users will be created with the object classes that you specify in your properties file, ldap.user.default.object.classes=top,person,inetOrgPerson,organizationalPerson.
  • Currently, only a limited number of fields are pushed out to LDAP (screenName, password, emailAddress, firstName, lastName and jobTitle).
  • Currently, groups can not be exported.

Password Policy (LDAP)

...

LDAP Settings in Liferay Portal

excerpt of portal.properties in Liferay Portal 4.2

Following are the properties to set it up in Liferay Portal 4.2 (note that this configuration has changed in the upcoming Liferay Portal 4.3, check the new portal.properties for the new configuration):

 ##
 ## LDAP Import
 ##
    ldap.import.enabled=false
    ldap.import.on.startup=false
    #
    # Enter time in minutes. This is how often the importer will synchronize
    # with LDAP. This property is portal wide. Company override will be ignored.
    #
    ldap.import.interval=10
    ldap.import.factory.initial=com.sun.jndi.ldap.LdapCtxFactory
    ldap.import.base.provider.url=ldap://localhost:10389
    ldap.import.base.dn=dc=example,dc=com
    ldap.import.security.principal=uid=admin,ou=system
    ldap.import.security.credentials=secret
    ldap.import.search.filter=(objectClass=inetOrgPerson)
    ldap.import.user.mappings=userId=cn\npassword=userPassword\nemailAddress=mail\nfirstName=givenName\nlastName=sn\njobTitle=title\ngroup=groupMembership
    ldap.import.group.mappings=groupName=cn\ndescription=description

excerpt of portal.properties in Liferay Portal 4.3

##
## LDAP
##

    #
    # Set the values used to connect to a LDAP store.
    #
    ldap.factory.initial=com.sun.jndi.ldap.LdapCtxFactory
    ldap.base.provider.url=ldap://localhost:10389
    ldap.base.dn=dc=example,dc=com
    ldap.security.principal=uid=admin,ou=system
    ldap.security.credentials=secret

    #
    # Settings for com.liferay.portal.security.auth.LDAPAuth can be configured
    # from the Admin portlet. It provides out of the box support for Apache
    # Directory Server, Microsoft Active Directory Server, Novell eDirectory,
    # and OpenLDAP. The default settings are for Apache Directory Server.
    #
    # The LDAPAuth class must be specified in the property "auth.pipeline.pre"
    # to be executed.
    #
    # Encryption is implemented by com.liferay.util.Encryptor.provider.class in
    # system.properties.
    #
    ldap.auth.enabled=false
    ldap.auth.required=false

    #
    # Set either bind or password-compare for the LDAP authentication method.
    # Bind is preferred by most vendors so that you don't have to worry about
    # encryption strategies.
    #
    ldap.auth.method=bind

    #
    # Active Directory stores information about the user account as a series of
    # bit fields in the UserAccountControl attribute.
    #
    # If you want to prevent disabled accounts from logging into the portal you
    # need to use a search filter similiar to the following:
    # (&(objectclass=person)(userprincipalname=@email_address@)(!(UserAccountControl:1.2.840.113556.1.4.803:=2)))
    #
    # See the following links:
    #     http://support.microsoft.com/kb/305144/
    #     http://support.microsoft.com/?kbid=269181
    #
    ldap.auth.search.filter=(mail=@email_address@)
    ldap.auth.password.encryption.algorithm=
    ldap.auth.password.encryption.algorithm.types=MD5,SHA

    #
    # The following settings are used to map LDAP users to portal users.
    #
    # You can write your own class that extends
    # com.liferay.portal.security.ldap.LDAPUser to customize the behavior for
    # exporting portal users to the LDAP store.
    #
    ldap.users.dn=dc=example,dc=com
    #ldap.users.dn=ou=users,dc=example,dc=com
    ldap.user.mappings=screenName=cn\npassword=userPassword\nemailAddress=mail\nfirstName=givenName\nlastName=sn\njobTitle=title\ngroup=groupMembership
    ldap.user.impl=com.liferay.portal.security.ldap.LDAPUser
    ldap.user.default.object.classes=top,person,inetOrgPerson,organizationalPerson

    #
    # The following settings are used to map LDAP groups to portal user groups.
    #
    ldap.groups.dn=ou=groups,dc=example,dc=com
    ldap.group.mappings=groupName=cn\ndescription=description\nuser=uniqueMember

    #
    # Settings for importing users and groups from LDAP to the portal.
    #
    ldap.import.enabled=false
    ldap.import.on.startup=false
    ldap.import.interval=10
    ldap.import.user.search.filter=(objectClass=inetOrgPerson)
    ldap.import.group.search.filter=(objectClass=groupOfUniqueNames)

    #
    # Set either user or group for import method. If set to user, portal will
    # import all users and the groups associated with those users. If set to
    # group, the portal import all groups and the users associated those groups.
    # This value should be set based on how your LDAP server stores group
    # membership information.
    #
    ldap.import.method=user
    #ldap.import.method=group

    #
    # Settings for exporting users from the portal to LDAP. This allows a user
    # to modify his first name, last name, etc. in the portal and have that
    # change get pushed to the LDAP server. This will only be active if the
    # property "ldap.auth.enabled" is also set to true.
    #
    ldap.export.enabled=true

    #
    # Set this to true to use the LDAP's password policy instead of the portal
    # password policy.
    #
    ldap.password.policy.enabled=false

    #
    # Set these values to be a portion of the error message returned by the
    # appropriate directory server to allow the portal to recognize messages
    # from the LDAP server. The default values will work for Fedora DS.
    #
    ldap.error.password.age=age
    ldap.error.password.expired=expired
    ldap.error.password.history=history
    ldap.error.password.not.changeable=not allowed to change
    ldap.error.password.syntax=syntax
    ldap.error.password.trivial=trivial
    ldap.error.user.lockout=retry limit

For those interested in specific details, the implementation of this functionality is done by the classes LDAPImportJob and LDAPImportUtil.

Set up

The best way to learn how to set up the Liferay LDAP integration is to check the available Lifecast at:

http://www.liferay.com/web/guest/documentation/4_2/installation_and_customization

(Direct link to the last version of the lifecast at the time of writting this: ldap_.swf)

You can use tools like JXplorer to browse your LDAP server:

Image:Ldap_jxplorer.jpg

http://www.jxplorer.org/

Troubleshooting

Recommended comprobations

  • Check the port where the LDAP server is running and make sure it matches Liferay's configuration. The default is 10389
  • Check the baseDN of the LDAP server and make sure it matches Liferay's configuration. The default is dc=example,dc=com
  • Check

How to log in if integration is broken

Omniadmin users are allowed to log in even if the integration with LDAP is broken. This allows to use this administrator accounts to fix the problem. The default user created with liferay (test@liferay.com) is an example of an omniadmin users. Others can be configured in portal.properties (or portal-ext.properties) indicating a comma separated list of user ids:

omniadmin.users=liferay.com.1,liferay.com.1001

Unit Test

To make sure that LDAP integration is working with the version of the sources that you are using (if not using a stable version) you can run LDAP from the test package:

ant test-ldap

Links

Lifecast on LDAP

Directory Operations JNDI

<!----> <!---->
分享到:
评论

相关推荐

    liferay cas ldap 集成配置

    - **LDAP配置**: - 配置 LDAP 连接信息,包括URL、端口、基础DN(Distinguished Name)、用户DN和密码。 - 指定用户属性映射,将Liferay中的用户属性与LDAP目录中的相应属性关联起来。 - 设置同步规则,决定何时...

    Liferay与LDAP集成

    在Liferay中配置LDAP需要设置LDAP的各个参数,如服务端口、搜索过滤器等,并且要确保Liferay服务器能够正确地连接到LDAP服务器。在Liferay 7.x及更高版本中,系统管理界面有专门的LDAP选项用于配置,可以将Liferay的...

    liferay + cas + ldap 集成配置

    标题 "Liferay + CAS + LDAP 集成配置" 涉及到的是在企业级内容管理系统 Liferay 中集成 Central Authentication Service (CAS) 和 Lightweight Directory Access Protocol (LDAP) 的过程。这种集成允许用户通过CAS...

    Liferay 6 入门教程

    "plugins开发指南13-liferay中使用ldap分析.pdf"讨论了Liferay与LDAP(轻量级目录访问协议)的集成,这对于大型企业需要与现有用户目录系统同步的场景非常有用。最后,"plugins开发指南19-liferay6中使用JSON.pdf...

    LifeRay+CAS+LDAP+Tomcat 单点登录门户.pdf

    在搭建 LifeRay+CAS+LDAP+Tomcat SSO 门户的过程中,首先需要配置 CAS 服务器。在本案例中,使用的是 CAS Server 3.2 和 CAS Client 3.1.10 版本。CAS 服务器负责验证用户的身份,而 CAS 客户端集成在 LifeRay 中,...

    Liferay的CAS SSO实现

    在实际应用中,Liferay的SSO功能可能还需要与其他身份管理解决方案,如LDAP(轻量级目录访问协议)或Active Directory集成,以利用已有的用户数据库。这些集成通常涉及到配置Liferay的用户目录服务,确保它们能够与...

    Liferay门户手册.pdf

    这一过程通常涉及到配置Liferay以使用LDAP服务器进行身份验证,可能需要调整Liferay的配置文件以适应LDAP服务器的特定设置。 ##### 4.4 集成应用安全单点登录 单点登录(Single Sign-On,SSO)允许用户在一个应用中...

    Liferay合集.zip

    中文文档部分可能包含了Liferay的基础教程、最佳实践、常见问题解答等,这些文档对于中文环境下的学习者来说尤其方便,能够快速理解Liferay的关键概念,解决在使用过程中遇到的问题。 通过学习这些资料,开发者可以...

    liferay教程

    此外,Liferay还支持SSO(Single Sign-On)和LDAP集成,以便于企业进行身份验证和权限管理。 在实际应用中,Liferay的自定义开发是必不可少的。开发者可以通过编写Java Portlets、JSR-286 Portlets或者Freemarker...

    Liferay管理员手册

    这部分可能包含如何配置集群以支持高可用性和负载均衡,如何集成企业级身份验证和授权解决方案(例如LDAP集成),以及如何通过Liferay的APIs和企业集成模式(EIPs)与其它企业系统集成。此外,还可能包括对性能调优和...

    liferay 资料

    - 为了优化性能,Liferay 支持缓存机制、负载均衡和集群配置。 10. **学习资源**: - 电子书是学习 Liferay 的宝贵资源,它们可能涵盖了入门教程、高级开发指南以及最佳实践案例。 通过对这些知识点的学习,...

    Liferay平台开发使用详细PPT演示文稿

    PPT中的演示部分可能涵盖了实际操作过程,包括Liferay的安装配置、portlet开发流程、工作流实例以及高可用性设置等。 此外,压缩包中的"UI"可能包含Liferay用户界面的设计示例,"架构图"可能详述了Liferay的系统...

    Liferay_Portal_门户解决方案

    Liferay Portal 的系统属性文件包括 portal.properties,用于配置 Liferay 的各种设置。 portal.properties 的常用配置包括: * Spring 配置文件 * Hibernate 配置文件 * JDBC 配置文件 * Company 设置 * Users ...

    liferay开发手册

    EXT插件可以用来替换或添加JAR文件、修改配置文件、甚至扩展Liferay的数据模型。虽然EXT插件提供了极大的灵活性,但它涉及到对Liferay核心的直接修改,因此在升级时需要特别注意,以免破坏兼容性。 Liferay 6.0.5...

    Liferay集成CAS实现单点登录与应用系统集成

    Liferay是一个基于Java的企业级门户解决方案,它具备强大的portlet应用、灵活的用户管理和权限分配、以及对多种认证系统的支持,如CAS、LDAP、OpenID、OpenSSO等。CAS作为一个独立的Web应用,主要负责身份验证,确保...

    liferay开发文档(20210921154012).pdf

    但是,从这段混乱的文字中,我们可以大致推测文档讨论的是关于Liferay的开发环境配置、核心概念、以及与Java相关的一些技术标准。我们可以尝试梳理这些内容,但请注意,因为原始文本的混乱,以下内容可能并不完全...

Global site tag (gtag.js) - Google Analytics