使用Apache Directory 的LDPA连接JOSSO验证

使用Apache Directory LDPA连接JOSSO验证

一、安装Apache Directory Suite. 1

二、Apache Directory Studio(Client)连接Apache Directory Server(Server) 5

三、用Apache Directory Studio增加用户和角色信息的Entry. 8

四、配置Jossojosso-gateway-config.xml 15[@more@]

使用Apache Directory LDPA连接JOSSO验证

一、安装Apache Directory Suite. 1

二、Apache Directory Studio(Client)连接Apache Directory Server(Server) 5

三、用Apache Directory Studio增加用户和角色信息的Entry. 8

四、配置Jossojosso-gateway-config.xml 15

一、安装Apache Directory Suite

下载apacheds-suite-1.0-setup.exe

下载地址:http://apache.mirror.phpchina.com/directory/apacheds/unstable/1.5/1.5.1/

双击安装,一路next,记住Apache Directory Server服务器的安装路径。

之中需要选择JDK的安装路径,所以之前必须安置好JDK,此处为安装的为JDK6,注意其默认找到的是jre,要该为jdk才行,如图:

安装最后,提示是否启动LDAP服务,选择是。确保服务启动。在管理,服务管理中看到

注意安装Apache Directory Serverinstancesdefaultconf目录下的server.xml配置文件,后面再客户端Apache Directory Studio中创建连接时用到其中的DN和密码等信息。

二、Apache Directory Studio(Client)连接Apache Directory Server(Server)

打开Apache Directory Studio,切换到LDAP视图模式下,如同

在左下角Connections视窗空白,点右键创建一个Connection,此处连接本地的Apache Directory Server。其中的Portserver.xml

<!-- The port to run the LDAP protocol on. --&gt

进行配置。

输入认证信息,这里的信息从之前提到的server.xml中获得,比如其中Bind DN or userBind password分别为server.xml中的

uid=admin,ou=system

secret

的值。

点击Fetch Base DNs获得Base DNFinish成功建立ClientServer的连接。

三、用Apache Directory Studio增加用户和角色信息的Entry

打开刚才建立的Connection,添加如下的树型信息。

其中ou=Peopleou=Roles为新建的Entry,分别存放用户的信息和角色的信息,其中角色信息中包括该角色有哪些用户。

添加过程:

添加ou=People

信息如下

dn: ou=People, dc=example,dc=com

ou: People

objectClass: top

objectClass: organizationalUnit

在其上级dc=example,dc=com上右键,New Entry…

选择默认,Next

选择objectClass

完成ou=People,接下来在其中添加两个用户user1user2

dn: uid=user1,ou=People, dc=example,dc=com

objectClass: top

objectClass: person

objectClass: organizationalPerson

objectClass: inetOrgPerson

sn: User1 SN

cn: User1 CN

uid: user1

userpassword: user1pwd

mail: user1@josso.org

dn: uid=user2,ou=People, dc=example,dc=com

objectClass: top

objectClass: person

objectClass: organizationalPerson

objectClass: inetOrgPerson

sn: User2 SN

cn: User2 CN

uid: user2

userpassword: user2pwd

mail: user2@josso.org

ou=People其上右键,New Entry…

过程和之前一样,只是选择objectClass时,应选organizationalPersoninetOrgPerson

完成时得到如图结果。

细心用户发现没有添加userpassword属性。

由于在添加该Attribute时,系统发现去是密码,所以要选择HASH加密算法,用户使看不到密码明文的,为了和Josso整合,笔者也对其进行了加密,采用的是MD5,然而后来在Josso的配置中同样采用相同的MD5用户登录时输入的密码也加密,以便和这里的匹配,然而,就是不对,因为大小写的问题吧,这里的Attribute得到的是小写的MD5结果,而Josso得到的是大写的MD5,二者不一致,把笔者郁闷了,根本不能用啊,要么我就得改Josso的源码,让其验证时不区分大小写。为了节约时间,笔者绕过这一属性,在Josso中改用email为密码,去掉密码加密,让用户输入邮箱来和这里的email Attribute匹配即可。

同理增加user2信息。

接着同理增加ou=Rolescn=role1cn=role2,并让role1user1user2role2user2

dn: ou=Roles, dc=example,dc=com

ou: Roles

objectClass: top

objectClass: organizationalUnit

dn: cn=role1,ou=Roles, dc=example,dc=com

objectClass: top

objectClass: groupOfUniqueNames

cn: role1

uniqueMember: uid=user1,ou=People, dc=example,dc=com

uniqueMember: uid=user2,ou=People, dc=example,dc=com

dn: cn=role2,ou=Roles, dc=example,dc=com

objectClass: top

objectClass: groupOfUniqueNames

cn: role2

uniqueMember: uid=user2,ou=People, dc=example,dc=com

注意,其中的cnou等名称在Josso配置中将用到。

四、配置Jossojosso-gateway-config.xml

1.修改中的内容如下:

org.josso.gateway.identity.service.store.ldap.LDAPIdentityStore

com.sun.jndi.ldap.LdapCtxFactory

ldap://localhost:10389/

uid=admin,ou=system

secret

simple

<!-- Valid values are : SUBTREE, ONELEVEL --&gt

SUBTREE

ou=People,dc=example,dc=com

uid

ou=Roles,dc=example,dc=com

uniquemember

cn

uid=username,mail=password

mail=mail,cn=description

2.修改中的内容如下:

org.josso.gateway.identity.service.store.ldap.LDAPIdentityStore

com.sun.jndi.ldap.LdapCtxFactory

ldap://localhost:10389/

uid=admin,ou=system

secret

simple

<!-- Valid values are : SUBTREE, ONELEVEL --&gt

ONELEVEL

ou=People,dc=example,dc=com

uid

ou=Roles,dc=example,dc=com

uniquemember

cn

uid=username,mail=password

mail=mail,cn=description

SUBTREE

注意以上两步中的

uid=username,mail=password

mail=password而不是userpassword=password,原因之前已经说明,这样的话就要求用户输入密码为用户的email时才能登录。

同时,注意以上两步中的ldap://localhost:10389/

uid=admin,ou=system

其中ldap://localhost:10389/可以在Apache Directory Studio

Root DSE上右键,查看Properties获得。

其中的uid=admin,ou=systemApache Directory Server中的server.xml一致。

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/8271432/viewspace-1002322/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/8271432/viewspace-1002322/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值