我使用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 and liferay 之间的配置,我应该使用相同的参数来集成 ldap with cas server
这是我的配置,以便将ldap与liferay集成
Base Provider URL
LDAP://192.168.0.88:389
Base DN
DC =部长,DC = FR
Principal
CN = LDAP请求者,OU =用户,OU =技术帐户,OU = P9帐户,DC = MINISTER,DC = FR
Credentials
部长$ 9999产品
Users
Authentication Search Filter
(&(objectClass的=人)(邮件= @ EMAIL_ADDRESS @))
Import Search Filter
(objectClass的=人)
User Mapping
Screen Name
sAMAccountName赋
Password
用户密码
Email Address
邮件
Full Name
CN
First Name
给定的名称
Middle Name
中间名字
Last Name
SN
Group
成员
Groups
Import Search Filter
(&(objectClass的=基团)(|(CN = MinisterUsers)(CN = MinisterAdministrateurs)(CN = Minister_ *)))
Group Mapping
Group Name
CN
Description
sAMAccountName赋
User
会员
出口
用户DN DC = MINISTER,DC = FR
组DN DC = MINISTER,DC = FR