cas+openldap實現單點登陸認證一

一、下載cas server:http://www.jasig.org/cas/download(本例使用的版本爲:cas-server-3.5.2-release.zip)java

二、下載spring ldap包(本例使用版本爲:spring-ldap-1.3.1.RELEASE-all.jar)web

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

四、定義openldap認證地址:<beans>跟節點下增長bean:ContextSource 的配置tomcat

    <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>app

五、配置FastBindLdapAuthenticationHandler認證處理器webapp

在<bean id=」authenticationManager」 />下找到SimpleTestUsernamePasswordAuthenticationHandler的配置,修改爲以下:ui

    <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>url

備註:注意版本的兼容性。
server

相關文章
相關標籤/搜索