(原创)LDAP与CAS单点登录集成
来源:互联网 发布:会计专用软件v6 编辑:程序博客网 时间:2024/05/16 23:25
我的百度空间中也可以访问到这些文章:hi.baidu.com/five00
编写CAS的配置文件deployerConfigContext-ldap.xml,这里配置了关于Ldap认证源的各种信息,代码如下:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="authenticationManager" class="org.jasig.cas.authentication.AuthenticationManagerImpl">
<property name="credentialsToPrincipalResolvers">
<list>
<bean
class="org.jasig.cas.authentication.principal.UsernamePasswordCredentialsToPrincipalResolver" />
<bean
class="org.jasig.cas.authentication.principal.HttpBasedServiceCredentialsToPrincipalResolver" />
</list>
</property>
<property name="authenticationHandlers">
<list>
<bean class="org.jasig.cas.authentication.handler.support.HttpBasedServiceCredentialsAuthenticationHandler" />
<bean class="org.jasig.cas.authentication.handler.support.HttpBasedServiceCredentialsAuthenticationHandler" />
<bean class="org.jasig.cas.adaptors.ldap.BindLdapAuthenticationHandler">
<property name="filter" value="uid=%u" />
<!-- 基节点 -->
<property name="searchBase" value="ou=People,ou=rootOrg,o=sevenSeas" />
<property name="contextSource" ref="contextSource" />
</bean>
</list>
</property>
</bean>
<bean id="contextSource" class="org.jasig.cas.adaptors.ldap.util.AuthenticatedLdapContextSource">
<property name="password" value="secret" />
<property name="pooled" value="true" />
<property name="urls">
<list>
<value>ldap://localhost:10389/</value>
</list>
</property>
<!—管理员 -->
<property name="userName" value="uid=admin,ou=system" />
<property name="baseEnvironmentProperties">
<map>
<entry>
<key><value>java.naming.security.authentication</value></key>
<value>simple</value>
</entry>
</map>
</property>
</bean>
</beans>
如果使用ou=People,ou=rootOrg,o=sevenSeas节点,如第7章的图所示,输出日志信息为:
[DEBUG] 2007-12-20 13:28:51,675 org.jasig.cas.web.flow.AuthenticationViaFormAction - Found existing form object with name 'credentials' of type [class org.jasig.cas.authentication.principal.UsernamePasswordCredentials] in scope Flow
[DEBUG] 2007-12-20 13:28:51,675 org.jasig.cas.CentralAuthenticationServiceImpl - Attempting to create TicketGrantingTicket for admin
username is [admin]
password is [secret]
[DEBUG] 2007-12-20 13:28:51,722 org.springframework.ldap.support.LdapContextSource - Principal: 'uid=admin,ou=system'
[DEBUG] 2007-12-20 13:28:52,113 org.springframework.ldap.support.LdapContextSource - Got Ldap context on server 'ldap://localhost:10389/'
cns is [[cn=admin]]
cns.isEmpty() is [false]
cns.size() is [1]
!this.allowMultipleAccounts is [true]
这是日志信息显示只有一个cn=admin的用户,可以进行Ldap认证。
如果将节点改为o=sevenSeas的话,如图:
以sevenSeas为基节点
再次验证日志信息会出现如下显示:
[DEBUG] 2007-12-20 13:43:56,347 org.jasig.cas.web.flow.AuthenticationViaFormAction - Found existing form object with name 'credentials' of type [class org.jasig.cas.authentication.principal.UsernamePasswordCredentials] in scope Flow
[DEBUG] 2007-12-20 13:43:56,347 org.jasig.cas.CentralAuthenticationServiceImpl - Attempting to create TicketGrantingTicket for admin
username is [admin]
password is [secret]
[DEBUG] 2007-12-20 13:43:56,363 org.springframework.ldap.support.LdapContextSource - Principal: 'uid=admin,ou=system'
[DEBUG] 2007-12-20 13:43:56,394 org.springframework.ldap.support.LdapContextSource - Got Ldap context on server 'ldap://localhost:10389/'
cns is [[cn=admin,ou=Roles,ou=rootOrg, cn=admin,ou=People,ou=rootOrg]]
cns.isEmpty() is [false]
cns.size() is [2]
!this.allowMultipleAccounts is [true]
这时我们看到people和role节点下面都有cn=admin,这时候allowMultipleAccounts的值为true,意味着当前有多歌同名帐号,系统不知道该选择哪个,所以会验证失败。这是需要注意的地方。v
- (原创)LDAP与CAS单点登录集成
- cas+ldap实现单点登录
- 基于CAS实现单点登录(SSO):CAS+LDAP实现单点登录认证
- CAS单点登录-客户端集成(cas-client)(九)
- SSL+CAS+LdAP实现单点登录
- CAS+LDAP实现单点登录认证
- shiro 集成cas单点登录
- (原创)Ldap与JetSpeed2集成部署
- (原创)Ldap与JetSpeed2集成部署
- Liferay 集成 CAS 实现单点登录与应用系统集成
- Spring Security集成CAS实现单点登录
- CAS 使用 ESUP 插件认证 LDAP 用户的单点登录
- SSO之CAS+LDAP实现单点登录认证
- 基于CAS SHIRO LDAP 的SSO单点登录
- CAS单点登录-Cas-Management(八)
- 单点登录(cas)、缓存技术与负载均衡
- Jeesite单点登录集成Cas另加自定义登录验证
- Jeesite单点登录集成Cas另加自定义登录验证
- Boost.Python构建与测试HOWTO
- 日本語の勉強
- 把ArcGIS矢量图转到CorelDraw中
- ORA-01033 错误(续)
- IE不显示PNG解决方法一则
- (原创)LDAP与CAS单点登录集成
- 点站点链接出现短时间白屏或闪屏现象
- javascript ajax提出异步请求
- 正则表达式 - 在线使用帮助
- 在GlassFish V2上使用Cluster并配置load balancer
- PROMISE SMARAID PDC20265R卡安装
- ActiveRecord中实体类问题解决方法
- SharePoint管理中心通过远程桌面不能访问,本机ie可以解决
- ALV 用对象的方法