将ldap与cas服务器集成

时间:2014-01-07 11:40:08

标签: tomcat active-directory cas

我使用cas-server-3.5.2,我想将CAS服务器与ldap

集成

我尝试使用此配置

我在 deployerConfigContext

中制作

这一行:

<bean id="authenticationManager"
        class="org.jasig.cas.authentication.AuthenticationManagerImpl">

        <!-- Uncomment the metadata populator to allow clearpass to capture and cache the password
             This switch effectively will turn on clearpass.
        <property name="authenticationMetaDataPopulators">
           <list>
              <bean class="org.jasig.cas.extension.clearpass.CacheCredentialsMetaDataPopulator">
                 <constructor-arg index="0" ref="credentialsCache" />
              </bean>
           </list>
        </property>
         -->

        <!--
            | This is the List of CredentialToPrincipalResolvers that identify what Principal is trying to authenticate.
            | The AuthenticationManagerImpl considers them in order, finding a CredentialToPrincipalResolver which 
            | supports the presented credentials.
            |
            | AuthenticationManagerImpl uses these resolvers for two purposes.  First, it uses them to identify the Principal
            | attempting to authenticate to CAS /login .  In the default configuration, it is the DefaultCredentialsToPrincipalResolver
            | that fills this role.  If you are using some other kind of credentials than UsernamePasswordCredentials, you will need to replace
            | DefaultCredentialsToPrincipalResolver with a CredentialsToPrincipalResolver that supports the credentials you are
            | using.
            |
            | Second, AuthenticationManagerImpl uses these resolvers to identify a service requesting a proxy granting ticket. 
            | In the default configuration, it is the HttpBasedServiceCredentialsToPrincipalResolver that serves this purpose. 
            | You will need to change this list if you are identifying services by something more or other than their callback URL.
            +-->
        <property name="credentialsToPrincipalResolvers">
            <list>
                <!--
                    | UsernamePasswordCredentialsToPrincipalResolver supports the UsernamePasswordCredentials that we use for /login 
                    | by default and produces SimplePrincipal instances conveying the username from the credentials.
                    | 
                    | If you've changed your LoginFormAction to use credentials other than UsernamePasswordCredentials then you will also
                    | need to change this bean declaration (or add additional declarations) to declare a CredentialsToPrincipalResolver that supports the
                    | Credentials you are using.
                    +-->
                <!--<bean class="org.jasig.cas.authentication.principal.UsernamePasswordCredentialsToPrincipalResolver" >
                    <property name="attributeRepository" ref="attributeRepository" />
                </bean>-->
                <bean 
     class="org.jasig.cas.adaptors.ldap.BindLdapAuthenticationHandler"> 
     <property name="filter" value="uid=%u" /> 
     <property name="searchBase" value="DC=MINISTER,DC=FR" />  
     <property 
        name="contextSource" 
        ref="contextSource" /> 
    </bean> 
                <!--
                    | HttpBasedServiceCredentialsToPrincipalResolver supports HttpBasedCredentials.  It supports the CAS 2.0 approach of
                    | authenticating services by SSL callback, extracting the callback URL from the Credentials and representing it as a
                    | SimpleService identified by that callback URL.
                    |
                    | If you are representing services by something more or other than an HTTPS URL whereat they are able to
                    | receive a proxy callback, you will need to change this bean declaration (or add additional declarations).
                    +-->
                <bean
                    class="org.jasig.cas.authentication.principal.HttpBasedServiceCredentialsToPrincipalResolver" />
            </list>
        </property>



<!--
    Config CAS with LDAP
    -->
    <bean id="contextSource" class="org.jasig.cas.adaptors.ldap.util.AuthenticatedLdapContextSource"> 
 <property name="anonymousReadOnly" value="false" /> 
 <property name="pooled" value="true"/> 
 <property name="urls"> 
    <list> 
   <value>ldap://192.168.0.88:389/</value> 

    </list> 
 </property> 
 <property name="userDn" value="DC=MINISTER,DC=FR"/> 
 <property name="groupDn" value="DC=MINISTER,DC=FR"/> 
 <property name="password" value="userPassword"/> 
 <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> 

我也在 pom.xml

<dependency> 
   <groupId>org.jasig.cas</groupId> 
   <artifactId>cas-server-support-ldap</artifactId> 
   <version>3.5.2</version> 
</dependency> 

我在 \ apache-tomcat-7.0.47 \ webapps \ cas-server-webapp-3.5.2 \ WEB-INF \ lib

中制作

CAS-服务器支持-LDAP的3.5.2.jar

但是当我启动cas服务器时出现此错误:

           ... 
    Caused by: java.lang.NoClassDefFoundError: org/springframework/ldap/NamingSecuri
    tyException
            at java.lang.Class.getDeclaredConstructors0(Native Method)
            at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
            at java.lang.Class.getConstructor0(Class.java:2699)
            at java.lang.Class.getDeclaredConstructor(Class.java:1985)
            at org.springframework.beans.factory.support.SimpleInstantiationStrategy
    .instantiate(SimpleInstantiationStrategy.java:67)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBean
    Factory.instantiateBean(AbstractAutowireCapableBeanFactory.java:990)
            ... 48 more
    Caused by: java.lang.ClassNotFoundException: org.springframework.ldap.NamingSecu
    rityException
            at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoa
    der.java:1702)
            at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoa
    der.java:1547)
            ... 54 more
    SafeContextLoaderListener:
    The Spring ContextLoaderListener we wrap threw on contextInitialized.
    But for our having caught this error, the web application context would not have
     initialized.
..........

我已经在 ldap和liferay 之间进行了配置,我应该使用相同的参数来集成 ldap与cas服务器

这是我的配置,以便将ldap与liferay集成

基本供应商网址

LDAP://192.168.0.88:389

基本DN

DC =部长,DC = FR

主要

CN = LDAP请求者,OU =用户,OU =技术帐户,OU = P9帐户,DC = MINISTER,DC = FR

凭据

部长$ 9999产品

用户

身份验证搜索过滤器

(及(objectClass的=人)(邮件= @ EMAIL_ADDRESS @))

导入搜索过滤器

(objectClass的=人)

用户映射

屏幕名称

sAMAccountName赋

密码

的userPassword

电子邮件地址

邮件

全名

CN

名字

给定名称

中间名

中间名

姓氏

SN

的memberOf

导入搜索过滤器

(及(objectClass的=基团)(|(CN = MinisterUsers)(CN = MinisterAdministrateurs)(CN =部长_ *)))

群组映射

群组名称

CN

描述

sAMAccountName赋

用户

构件

导出

用户DN DC =部长,DC = FR

群组DN DC =部长,DC = FR

0 个答案:

没有答案