[Liferay] Liferay 实现单点登录 - OpenLDAP

Liferay 的单点登录绝对是个难啃的骨头,更何况网上能搜到的基本都是些滥竽充数的文章,很不负责任。

于是在自己搭通单点登录一条线之后,决定整理下思路并写出来,希望各位能别重蹈覆辙。

本文不介绍概念。仅仅注重实现

软件版本号:

Liferay : 6.1.1 CE GA2
OpenLdap for Windows :openldap-2.4.38-x86
Apache Directory Studio : Apache Directory Studio 2.0.0-M3
CAS : cas-server-3.5.2
Windows : 7 x64

第一篇 OpenLDAP

不再讲述 LDAP 概念,仅仅需知道 OpenLDAP 是 LDAP 协议的几个主流实现之中的一个,重点是介绍怎样在 windows 平台上安装和配置 OpenLDAP。

下载

openLDAP官方站点:http://www.openldap.org/
openLDAP官网仅仅提供了linux平台的相关安装文件,windows平台的安装包能够到下面一些站点下载:
http://www.userbooster.de/download/openldap-for-windows.aspx
http://sourceforge.jp/projects/openldapwin32/releases/
http://sourceforge.net/projects/openldapwindows/files/

http://sourceforge.net/projects/openldapwindows/(本文所用的版本号)


以上四个地址中第一个安装完毕之后 LDAP server 启动总是异常,并没有详细分析原因,直接卸载安装最后一个链接中的版本号,好使。

安装

一路点击 next 就可以,注意默认的 backend engine 为 BDB,意思也就是 LDAP 使用 BDB 存储数据,能够依据需求自行配置如 SQL Server 等。
安装完毕之后找到安装路径下的E:\OpenLDAP\etc\openldap。打开slapd.conf,替换整个内容为
include   ../etc/openldap/schema/core.schema
include   ../etc/openldap/schema/cosine.schema
include   ../etc/openldap/schema/inetorgperson.schemapidfile ../var/run/slapd.pidloglevel  -1moduleload back_bdb.ladatabase bdb
suffix "dc=example, dc=com"rootdn "cn=jimbob, dc=example, dc=com"
rootpw dirtysecretdirectory       ../var/openldap-data# Indices to maintain for this directory
# unique id so equality match only
index uid eq
# allows general searching on commonname, givenname and email
index cn,gn,mail eq,sub
# allows multiple variants on surname searching
index sn eq,sub
# sub above includes subintial,subany,subfinal
# optimise department searches
index ou eq
# if searches will include objectClass uncomment following
# index objectClass eq
# shows use of default index parameter
index default eq,sub
# indices missing - uses default eq,sub
index telephonenumber# other database parameters
# read more in slapd.conf reference section
cachesize 10000
checkpoint 128 15

当中


suffix "dc=example, dc=com"
能够理解为整个 LDAP 的跟文件夹地址。能够自行配置
rootdn "cn=jimbob, dc=example, dc=com" rootpw dirtysecret
管理员用户的 DN 以及password,能够自行配置
directory       ../var/openldap-data
LDAP 数据库文件夹
至于其它參数我临时也不关心是什么意思。

启动 LDAP server

这个安装版本号中。不须要通过命令行启动,開始菜单里找到 OpenLDAP。并启动

看到例如以下内容就算是启动成功了

一般教程到这里都会提示须要新建个 .ldif 文件,用来加入用户或者组织,事实上刚開始大可不必纠结于这个文件以及里面的语法。由于全然能够使用 LDAP 可视化工具完毕相同的工作。

但毕竟写文档。这部分还是得写。

LDIF 文件

DIT 结构 – 例如以下图,能够理解为LDAP 的结构文件夹,就比方 Java Web应用的文件夹。

在E:\OpenLDAP 文件夹创建demo.ldif 文件。粘贴下面的 内容,用来创建 DIT 结构。并加入用户
dn: dc=example,dc=com
dc: example
description: text whatever you want for description
objectClass: dcObject
objectClass: organization
o: Example, Inc.dn: ou=people, dc=example,dc=com
ou: people
description: All people in organisation
objectclass: organizationalunitdn: cn=Robert Smith,ou=people,dc=example,dc=com
objectclass: inetOrgPerson
cn: Robert Smith
sn: smith
uid: rjsmith
userpassword: rJsmitH
mail: rsmith@example.com
description: swell guy
ou: Human Resources

在E:\OpenLDAP\bin文件夹下输入下面指令用来导入 LDIF 文件。为什么要到这个文件夹。由于这个文件夹底下有ldapadd.exe,不然使用 ldapadd 指令会提示提示:’ldapadd’ 不是内部或外部命令。也不是可执行的程序或批处理文件

ldapadd -x -D "cn=jimbob,dc=example,dc=com" -f ./mydemo.ldif -w dirtysecret

接下来通过下面search 指令确认是否导入成功

ldapsearch -x -b "dc=example,dc=com" "(objectclass=*)"

LDAP client Apache Directory Studio

LDAP 有多种client,本文使用的是Apache Directory Studio,没什么特别原因,就是认为 Apache 相对照较亲切一点。
下载地址 :http://directory.apache.org/studio/downloads.html
下载最新版的就可以。

安装以及配置步骤能够參考官方文档https://directory.apache.org/studio/users-guide/ldap_browser/gettingstarted_download_install.html
左下 Connection 区域点击右键加入 Connection。

注意 OpenLdap 的 Port 为 389。

Bind DN or User :slapd.conf 文件内的rootdn
Bind password : slapd.conf 文件内的rootpw
点解 Check Authentication 确认验证成功

之后点击 Finish,配置成功。能够在左側 LDAPBrowser 里看到整个 DIT 结构。

Liferay 配置 LDAP

在 Liferay 的 Crontrol Panel 找到 LDAP 配置界面,点击加入 LDAP Server。
Server Name – 没什么可说的
Default Values – 仅仅有当你想切换 LDAP 工具时。依据详细的 LDAP 实现工具来重置底下全部属性
Connection : 配置用来连接 LDAP server

Users

User Mapping – 用来映射 LDAP 内 user 属性与 Liferay 内user属性

Groups – 相应于  LDAP 里的 group

Export – 这个必须配置,不然无法将 Liferay 用户到处到 LDAP server,导致配置完毕之后, Liferay 用户反而不能成功登录

保存,回到LDAP主界面,确认选择 Enabled 与 Required, Liferay 官方对这两个属性解释例如以下:
ldap.auth.enabled=true
Set ldap.auth.enabled = true to enable LDAP Authentication

ldap.auth.required=true
Setting required = true means that you must successfully bind with the record in the LDAP server before Liferay will allow the user to log in

确认选择 Import / Export
Liferay 官方解释例如以下:
ldap.import.enabled=true
If set to true, then Liferay will do a mass import of users on the specified interval

ldap.import.on.startup=true
If set to true, Liferay will do a mass import of all LDAP users according to the import method (that match the user specified search filter) on startup

ldap.export.enabled=true
If set to true, Liferay will export the user to LDAP. 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. Note that on every login, fields such as "LastLoginDate" are updated and so if export is enabled, logging in with a user will export the user to LDAP.

上述步骤仅仅是单点登录的准备工作而已。仅仅要能在 Liferay 配置 LDAP 界面 Test 成功就算是配置正确。

posted on 2017-04-30 17:41 mthoutai 阅读(...) 评论(...) 编辑 收藏

转载于:https://www.cnblogs.com/mthoutai/p/6789935.html

[Liferay] Liferay 实现单点登录 - OpenLDAP相关推荐

  1. Liferay门户与CAS实现SSO单点登录

    http://blog.csdn.net/yang_19790212/article/details/6635778 1.1 准备工作 1.1.1  安装JDK1.6.0.20 JAVA 1.6.0以 ...

  2. CAS单点登录(SSO)介绍及部署

    介绍 CAS CAS 是Yale(耶鲁)大学的一个开源的企业级单点登录系统,它的特点: Java (Spring Webflow/Spring Boot) 服务组件 可插拔身份验证支持(LDAP,Da ...

  3. Web 单点登录系统 JA-SIG CAS

    JA-SIG CAS(Central Authentication Service)为Web应用系统提供了单点登录服务.它的特性包括:一个开放和具有很好文档支持的协议:一个Java开源服务器组件:提供 ...

  4. 框架CAS实现SSO单点登录功能

    1. 概述 1.1. 什么是SSO? 单点登录( Single Sign-On , 简称 SSO )是目前比较流行的服务于企业业务整合的解决方案之一, SSO 使得在多个应用系统中,用户只需要 登录一 ...

  5. 自动化运维平台中的统一认证接入与单点登录实现

    前言: 在运维开发的众多系统中,怎么能更好的管理用户账号和密码,以及做到统一的brac权限角色配置系统. 以前记得最初做运维开发项目的时候,每个app都是一套用户密码,顶多做了一个加密流转,申请接入的 ...

  6. 构建和实现单点登录解决方案(转载于IBMdeveloperWorks)

    将一个开放源码的基于 Java 的身份验证组件集成进 Web 门户中 在现有的应用程序中实现单点登录解决方案(single sign-on,SSO,即登录一次,就可以向所有网络资源验证用户的身份)是非 ...

  7. 构建和实现单点登录解决方案

    将一个开放源码的基于 Java 的身份验证组件集成进 Web 门户中 在现有的应用程序中实现单点登录解决方案(single sign-on,SSO,即登录一次,就可以向所有网络资源验证用户的身份)是非 ...

  8. Keycloak vs MaxKey,开源单点登录框架如何选择?

    单点登录(Single Sign On)简称为SSO,用户只需要登录认证中心一次就可以访问所有相互信任的应用系统,无需再次登录. 主要功能: 所有应用系统共享一个身份认证系统 所有应用系统能够识别和提 ...

  9. 统一认证管理系统(单点登录系统)sso 浅谈

    我所在的公司比较大,内部的各种管理系统和业务系统比较多,然而所有的系统都可以用公司的OA的员工工号和密码直接进行登录 (当然登录界面都是一个就是内部OA门户).从进入公司以来我就一直有个问题,这是怎么 ...

最新文章

  1. iOS 关于第三方键盘
  2. JavaScript---事件监听
  3. 大数据(生于2006,卒于2019)已死!
  4. 为什么优酷站点限制不了_什么是站点可靠性工程师,为什么要考虑这个职业道路
  5. 直播丨数据库上云趋势下,如何面对海量数据迁移及落地实践-2021云和恩墨大讲堂...
  6. Serial Interface之I2C:关于DS1624 2线通信SDA保持时间的说明
  7. 用python做思维导图软件_两款好用的思维导图工具详细介绍,Xmind和幕布
  8. NoSQL数据库介绍(7)
  9. WPF快速学习--一布局
  10. java期末李鹤_Willike
  11. mapboxGL入门详解
  12. 【数字化】“网络效应”指南:13 种网络效应全解析,带你了解巨头成功的秘密
  13. 自学考试-“运筹学基础”
  14. 解决低版本ios使用html2canvas截图空白问题
  15. arduino yun 京东_ArduinoYun教程之配置Arduino Yun环境
  16. English--七种句子成分概述
  17. sendmail 电子邮件服务器
  18. element UI 表格实现 表尾合计行 ——小肉包
  19. 什么是虚拟专用服务器?虚拟专用服务器说明
  20. CDC和HDC的区别与转换

热门文章

  1. 后序遍历的非递归算法python_Python非递归实现二叉树的后续遍历
  2. 电脑发短信_让电脑自动给老婆发短信?!这个懒到极致的大神,我是服了...
  3. apollo编译源码使用并将eureka替换为自己的eureka服务
  4. Java将数组(Array)用固定分隔符拼接成字符串(String)
  5. RecyclerView的各种版本兼容问题处理集锦
  6. 第二轮 冲次会议第一次
  7. (三)Redis两种持久化方案
  8. python基础七--集合
  9. JS实现表单多文件上传样式美化支持选中文件后删除相关项
  10. memcached演练(2) 访问memcached服务