zoukankan      html  css  js  c++  java
  • ldap的实现单点登录

    cas+ldap  连接多哥ldap时大多数引用的都是这个类,但是我中cas -server -supper-ldap3以上的jar中都找不到此类,迷惑了很久于是我找了源码配置文件发现根本不是引用这个类,下面介绍一下cas+ldap连接的两种方式
    方式一: 连接单个ldap
    [code=html]
    在cas的deployerConfigContext.xml这个文件中找到<bean class="org.jasig.cas.authentication.handler.support.SimpleTestUsernamePasswordAuthenticationHandler" />注释掉添加下面的bean
    <bean class="org.jasig.cas.adaptors.ldap.FastBindLdapAuthenticationHandler">
    <property name="filter" value="uid=%u,ou=People,o=tcl,c=cn" />
    <property name="contextSource" ref="contextSource" />
    </bean>
    在根节点中添加
    <bean id="contextSource" class="org.springframework.ldap.core.support.LdapContextSource">
    <property name="pooled" value="false"/>
    <property name="url" value="ldap://192.168.0.114:389" />
    <property name="userDn" value="cn=Manager,o=tcl,c=cn"/>
    <property name="password" value="secret"/>
    <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>
    [/code]
    方式二: 可连接多ldap
    [code=html]
    <bean class="org.jasig.cas.adaptors.ldap.BindLdapAuthenticationHandler">
    <property name="filter" value="uid=%u" />
    <property name="searchBase" value="ou=People,o=tcl,c=cn" /> 
    <property name="contextSource" ref="contextSource" />
    </bean>
    根节点添加
    <bean id="contextSource" class="org.springframework.ldap.core.support.LdapContextSource">  
    <property name="anonymousReadOnly" value="false" />
    <property name="password" value="secret" />
    <property name="pooled" value="true" />
    <property name="urls">
    <list>
    <value>ldap://192.168.0.114:389/</value>
    </list>
    </property>
    <property name="userDn" value="cn=Manager,o=tcl,c=cn" />
    <property name="baseEnvironmentProperties">
    <map>
    <!--<entry>
    <key><value>java.naming.security.protocol</value></key>
    <value>ssl</value>
    </entry>-->
    <entry>
    <key><value>java.naming.security.authentication</value></key>
    <value>simple</value>
    </entry>
    </map>
    </property>
    </bean>
    [/code]

  • 相关阅读:
    实现对DataGird控件的绑定操作
    EasyUI-datagrid中load,reload,loadData方法的区别
    easui Pagination Layout
    easyUI datagrid 排序
    jQuery EasyUI教程之datagrid应用
    solr入门之多线程操作solr中索引字段的解决
    序列自相关矩阵的计算和分析
    UVa 12403
    滑动窗体的最大值(STL的应用+剑指offer)
    bzoj2101【Usaco2010 Dec】Treasure Chest 藏宝箱
  • 原文地址:https://www.cnblogs.com/jasonwan/p/10735973.html
Copyright © 2011-2022 走看看