cas+openldap实现单点登录认证一

孤街浪徒 提交于 2020-04-07 10:26:31

1、下载cas server:http://www.jasig.org/cas/download(本例使用的版本为:cas-server-3.5.2-release.zip)

2、下载spring ldap包(本例使用版本为:spring-ldap-1.3.1.RELEASE-all.jar)

3、部署cas server 修改配置文件:F:\sso\tomcat-cas\webapps\cas\WEB-INF\deployerConfigContext.xml

4、定义openldap认证地址:<beans>跟节点下增加bean:ContextSource 的配置

    <bean id="contextSource" class="org.springframework.ldap.core.support.LdapContextSource">
          <property name="pooled" value="false"/>
          <property name="url" value="ldap://192.168.10.237:389" />
          <property name="userDn" value="cn=Manager"/>
          <property name="password" value="secret"/><!--  自己openldap的密码 -->
          <property name="baseEnvironmentProperties">
            <map>
              <entry key="com.sun.jndi.ldap.connect.timeout" value="3000" />
              <entry key="com.sun.jndi.ldap.read.timeout" value="3000" />
              <entry key="java.naming.security.authentication" value="simple" />
            </map>
          </property>
        </bean>

5、配置FastBindLdapAuthenticationHandler认证处理器

在<bean id=”authenticationManager” />下找到SimpleTestUsernamePasswordAuthenticationHandler的配置,修改成如下:

    <bean class="org.jasig.cas.adaptors.ldap.FastBindLdapAuthenticationHandler">
            <property name="filter" value="uid=%u,ou=dev,dc=micmiu,dc=com" />
            <property name="contextSource" ref="contextSource" />
    </bean>

备注:注意版本的兼容性。


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!