<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Junky's IT Notebook

    統計

    留言簿(8)

    積分與排名

    WebSphere Studio

    閱讀排行榜

    評論排行榜

    CAS 使用 ESUP 插件認證 LDAP 用戶的單點登錄(轉)

    ESUP為CAS的SSO提供了LDAP用戶模式,本文詳細論述了使用LDAP認證的配置方式,它主要分為兩種主要形式:快速綁定和搜尋模式。在實際使用時,我使用了更為通用的搜尋模式。

    前面的一篇文章我曾經介紹了使用Tomcat簡單部署CAS的方法,但對于用戶名和密碼只是做相同性的校驗匹配驗證,下面我將一步步將其改變為使用Sun Directory Server進行用戶認證的方式。

    1. 下載esup-casgeneric-2.0.5-2,將其部署到CAS源代碼中。方法很簡單,修改其properties文件,指定CAS源代碼的存儲位置,在我機器中我將其指向了eclipse的workspace工作目錄中的CAS應用。隨后使用ant編譯其build.xml腳本,實際上運行該教本只是做了一個復制拷貝工作,將ESUP的源代碼文件和配置文件復制到CAS源碼中。
    2. 修改原有CAS的認證方式,在web.xml中,將CAS的認證控制器由默認的edu.yale.its.tp.cas.auth.provider.SampleHandler改為ESUP的GenericHandler,修改后的內容如下:
      <context-param>
              <param-name>edu.yale.its.tp.cas.authHandler</param-name>
              <param-value>org.esupportail.cas.server.GenericHandler</param-value>
      </context-param>
    3. 修改ESUP的配置文件genericHandler.xml,將其默認的控密碼和相同性驗證方式改為LDAP驗證方式,并同時配置LDAP相關信息,下面是修改前與修改后的內容:
      修改前:
      <authentication empty_password_accepted="on" debug="on">
          <handler>
              <classname>
                  org.esupportail.cas.server.handlers.test.EmptyPasswordHandler</classname>
          </handler>
          <handler>
              <classname>
                  org.esupportail.cas.server.handlers.test.PasswordEqualsUsernameHandler</classname>
          </handler>
      </authentication>
      修改后:
      <authentication debug="off">
          <handler>
              <classname>
                  org.esupportail.cas.server.handlers.ldap.BindLdapHandler</classname>
              <config>
                  <search_base>ou=People,dc=sjtu,dc=edu,dc=cn</search_base>
                  <filter>uid=%u</filter>
                  <scope>sub</scope>
                  <bind_dn>cn=Directory Manager</bind_dn>
                  <bind_password>password</bind_password>
                  <server>
                      <url>ldap://yuanxz.sjtu.edu.cn:389/</url>
                  </server>
                  <disable_multiple_accounts/>
              </config>
          </handler>
      </authentication>
    4. 修改ESUP日志記錄配置文件LoggerConf.xml,修改名為File的參數,將其value指向希望的日志存儲位置:<param name="File" value="c:/tomcat/logs/esup-casgeneric.log" />
    5. 重新部署CAS應用到Tomcat,即再次運行build.xml的ant教本,重新啟動Tomcat,進入Servlet-Examples的應用實例,點擊執行后瀏覽器仍自動跳轉到CAS的認證登錄界面,在用戶名和密碼欄中輸入位于LDAP中用戶信息,即可通過驗證。
    6. 驗證日志文件,打開步驟4中配置的日志文件,可以看到CAS成功地連接了LDAP數據庫并通過了驗證,日志示例如下:
      INFO [http-8443-Processor24] root.[] 三月/11 14:04:14 - ESUP-Portail Generic Handler 2.0.5-2, reading configuration file...
      INFO [http-8443-Processor24] root.[] 三月/11 14:04:15 - Configuration file read without any error.
      INFO [http-8443-Processor24] root.[] 三月/11 14:04:20 - Authentication succeeded for user `yuanxz'.

    LDAP authentication with CAS GH

    As LDAP became a standard for user referencials, authentication on an LDAP directory is the most widely used method nowadays. LDAP authentication configuration consists in specifying:

    • the mode used to access LDAP servers (see bellow);
    • an LDAP server or a list of LDAP servers (for redundancy);

    Two access modes are provided (bind and fastbind), depending on the internal structure of the LDAP directory.

    Direct access mode (fastbind)

    The fastbind method can be used with LDAP directories of which the users' Distinguished Names can be directly deduced from their login name (practically, LDAP directories where all the users are stored at the same hierarchical level).

    In this mode, CAS tries to connect to the LDAP directory with the user's DN and the password provided.

    One may use:

    <authentication debug="off">
    <handler>
    <classname>org.esupportail.cas.server.handlers.ldap.FastBindLdapHandler</classname>
    <config>
    <filter>uid=%u,ou=people,dc=esup-portail,dc=org</filter>
    <server>
    <url>ldap://ldap.esup-portail.org</url>
    </server>
    <server>
    <url>ldap://replica.esup-portail.org</url>
    </server>
    </config>
    </handler>
    </authentication>

    When using the ldap_fastbind method, the administrator should only spécify the filter to find the users' DN in the directory. The following tokens (similar to ldap_saslauthd) can be used in the filter string:

    • %% = %
    • %u = user
    • %U = user portion of %u (%U = test when %u = test@domain.tld)
    • %d = domain portion of %u (%d = domain.tld when %u = test@domain.tld)
    • %1-9 = domain tokens (%1 = tld, %2 = domain when %d = domain.tld)
    • %s = service
    • %r = realm

    The %u token has to be used at minimum for the filter to be useful. Defaults to uid=%u.

    Search mode (bind)

    When users are located in different branches of the directory, deducing the users' DN from their login name is impossible. In this case, the ldap_bind mode should be used. It performs a search in the directory before trying to connect.

    One may use:

    <authentication debug="off">
    <handler>
    <classname>org.esupportail.cas.server.handlers.ldap.BindLdapHandler</classname>
    <config>
    <search_base>ou=people,dc=esup-portail,dc=org</search_base>
    <filter>uid=%u</filter>
    <scope>sub</scope>
    <bind_dn>admin</bind_dn>
    <bind_password>secret</bind_password>
    <server>
    <url>ldap://ldap.esup-portail.org</url>
    </server>
    <server>
    <url>ldap://replica.esup-portail.org</url>
    </server>
    <disable_multiple_accounts/>
    </config>
    </handler>
    </authentication>

    When using the bind method, the administrator should specify:

    • the start point of the search (e.g. dc=univ-rennes1,dc=fr). Tokens described in the filter attribute (see above) can be used for substitution;
    • the search scope (can be sub, one or base). Defaults to sub;
    • the filter to find the users' DN in the directory;
    • parameters to connect to the LDAP directory (when ommited, an anonymous connection is used);
    • whether multiple accounts for users are allowed or not, thanks to the <enable_multiple_accounts> and <disable_multiple_accounts> tags (by default, they are not allowed). If the result of the LDAP search has more then one result, no connection to the LDAP directory is done and the authentication is refused. This feature was added in version 2.0.5.

    LDAP servers

    The LDAP servers are defined by:

    • their LDAP URL.

    When specifying several servers, all the servers are considered as replicates: when authentication fails on one directory, LDAP authentication fails because directories are intended to contain the same data; next (redundant) servers are tried only if the first one does not respond.

    Specifying many replicas can be done by specifying a space-separated list of LDAP URLs in the <url> element (these URLs will be handled by JNDI (since JDK 1.4) as precised in http://java.sun.com/products/jndi/tutorial/ldap/misc/url.html. Alternatively, using several <server> elements can help debugging.

    posted on 2007-06-05 16:35 junky 閱讀(1053) 評論(0)  編輯  收藏 所屬分類: security

    主站蜘蛛池模板: 成人午夜18免费看| 亚洲自偷自偷偷色无码中文| 亚洲精品无码中文久久字幕| 在线观看永久免费视频网站| fc2免费人成在线视频| 精品亚洲成a人片在线观看少妇| 国产99视频精品免费观看7| 无码色偷偷亚洲国内自拍| 亚洲Av综合色区无码专区桃色| 欧洲乱码伦视频免费| 一级看片免费视频| 亚洲男女性高爱潮网站| 免费少妇a级毛片| 一级毛片免费观看| 色噜噜狠狠色综合免费视频| 久久精品国产精品亚洲色婷婷| 妞干网免费视频观看| 日本免费中文视频| 精品亚洲国产成人av| 91亚洲国产成人精品下载| 四虎永久在线精品免费观看地址 | 免费毛片毛片网址| 久久久亚洲欧洲日产国码是AV| 国产免费久久精品久久久| 91精品国产免费| caoporn成人免费公开| 亚洲天堂2017无码中文| 亚洲成AV人在线观看天堂无码| 日韩精品视频免费网址| 无码少妇精品一区二区免费动态 | h视频在线观看免费网站| 中文字幕亚洲免费无线观看日本| 亚洲av无码兔费综合| 蜜芽亚洲av无码精品色午夜| 亚洲成人一区二区| 免费视频淫片aa毛片| 91福利免费体验区观看区| 久久久久免费视频| 亚洲国产精品成人综合色在线| 久久亚洲精品无码aⅴ大香 | 国产午夜影视大全免费观看|