Connecting CAS 3.1.1 to LDAP
Andrew Petro
apetro at unicon.net
Fri Jan 11 15:34:28 EST 2008
Zach,
It looks to me like you have a slight error in your Spring XML
configuration here.
<bean class="org.jasig.cas.adaptors.ldap.BindLdapAuthenticationHandler">
<property name="contextSource" value="contextSource" />
</bean>
What this says is "Hey, Spring, there's a property named
"contextSource", please set it to the value "contextSource", like so:
BindLdapAuthenticationHandler handler = new
BindLdapAuthenticationHandler();
handler.setContextSource("contextSource");
This doesn't work for the reason one might expect: the
setContextSource() method takes an argument of type ContextSource, not
an argument of type String. That's what this error message is trying
to say:
"java.lang.IllegalArgumentException: Cannot convert value of type
[java.lang.String] to required type
[org.jasig.cas.adaptors.ldap.util.AuthenticatedLdapContextSource] for
property 'contextSource': no matching editors or conversion strategy
found"
You've defined a bean *named* contextSource soon following in the
configuration. This property declaration needs to *reference* that
bean.
<property name="contextSource">
<ref bean="contextSource"/>
</property>
Andrew
Andrew Petro
Unicon, Inc. = A JA-SIG commercial affiliate offering services,
support, and training for open source software in education.
On Jan 11, 2008, at 12:08 PM, Zach Seifts wrote:
> Adam,
>
> I tried adding "https://" to the url of my ad server and it's still
> giving me the same error message. I'm wondering if its not able to
> locate BindLdapAuthenticationHandler or something of that nature;
> the dependency is in cas-server-webapp/pom.xml.
>
> Cheers
> Zach
>
>
>
> Zach Seifts
> Central Piedmont Community College
> 704.330.6988
> zach.seifts at cpcc.edu
>
>
>
> Adam Rybicki wrote:
>>
>> Zach,
>>
>> That needs to be a full URL. Also, since you have SSL enabled for
>> accessing LDAP, I think that your URL should start with ldaps://
>> rather than ldap://. If you are using the default port number, 389
>> for ldap and 636 for ldaps, you shouldn't have to specify the port
>> number in the URL.
>>
>> Adam
>>
>> Zach Seifts wrote:
>>>
>>> Hey everyone,
>>>
>>> I'm having some trouble trying to setup a cas3 server which
>>> connects to MS-AD with LDAP (running on etch's tomcat). I've been
>>> following the LDAP tutorial on the ja-sig wiki and after
>>> everything is configured the way it says in the tutorial, I
>>> compile and deploy the war file to tomcat and it won't start up.
>>> The logs tell me i have errors in my deployerConfigContext.xml
>>> which leads me to think my something in the contextSource bean
>>> isn't configured correctly. I don't have "ldap://" in front of the
>>> server name in the urls property, do I need that? Any insight
>>> would be helpful.
>>>
>>> Cheers
>>> Zach
>>>
>>> Logs:
>>> 2008-01-10 10:40:37,494 ERROR
>>> [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/
>>> cas-server-webapp-3.1.1]] - <Exception starting filter Acegi
>>> Filter Chain Proxy>
>>> org.springframework.beans.factory.BeanCreationException: Error
>>> creating bean with name 'centralAuthenticationService' defined in
>>> ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot
>>> resolve reference to bean 'authenticationManager' while setting
>>> bean property 'authenticationManager'; nested exception is
>>> org.springframework.beans.factory.BeanCreationException: Error
>>> creating bean with name 'authenticationManager' defined in
>>> ServletContext resource [/WEB-INF/deployerConfigContext.xml]:
>>> Cannot create inner bean
>>> 'org
>>> .jasig.cas.adaptors.ldap.BindLdapAuthenticationHandler#1416de4' of
>>> type [org.jasig.cas.adaptors.ldap.BindLdapAuthenticationHandler]
>>> while setting bean property 'authenticationHandlers' with key [1];
>>> nested exception is
>>> org.springframework.beans.factory.BeanCreationException: Error
>>> creating bean with name
>>> 'org
>>> .jasig.cas.adaptors.ldap.BindLdapAuthenticationHandler#1416de4'
>>> defined in ServletContext resource
>>>
>>> [/W
>>> EB-INF/deployerConfigContext.xml]: Initialization of bean failed;
>>> nested exception is
>>> org.springframework.beans.TypeMismatchException: Failed to convert
>>> property value of type [java.lang.String] to required type
>>> [org.jasig.cas.adaptors.ldap.util.AuthenticatedLdapContextSource]
>>> for property 'contextSource'; nested exception is
>>> java.lang.IllegalArgumentException: Cannot convert value of type
>>> [java.lang.String] to required
>>> type
>>> [org.jasig.cas.adaptors.ldap.util.AuthenticatedLdapContextSource]
>>> for property 'contextSource': no matching editors or conversion
>>> strategy found
>>> Caused by:
>>> org.springframework.beans.factory.BeanCreationException: Error
>>> creating bean with name 'authenticationManager' defined in
>>> ServletContext resource [/WEB-INF/deployerConfigContext.xml]:
>>> Cannot create inner bean
>>> 'org
>>> .jasig.cas.adaptors.ldap.BindLdapAuthenticationHandler#1416de4' of
>>> type [org.jasig.cas.adaptors.ldap.BindLdapAuthenticationHandler]
>>> while setting bean property 'authenticationHandlers' with key [1];
>>> nested exception is
>>> org.springframework.beans.factory.BeanCreationException: Error
>>> creating bean with name
>>> 'org
>>> .jasig.cas.adaptors.ldap.BindLdapAuthenticationHandler#1416de4'
>>> defined in ServletContext resource [/WEB-INF/
>>> deployerConfigContext.xml]: Initialization of bean failed; nested
>>> exception is org.springframework.beans.TypeMismatchException:
>>> Failed to convert property value of type [java.lang.String] to
>>> required type
>>> [org.jasig.cas.adaptors.ldap.util.AuthenticatedLdapContextSource]
>>> for property 'contextSource'; nested
>>>
>>> exc
>>> eption is java.lang.IllegalArgumentException: Cannot convert value
>>> of type [java.lang.String] to required type
>>> [org.jasig.cas.adaptors.ldap.util.AuthenticatedLdapContextSource]
>>> for property 'contextSource': no matching editors or con version
>>> strategy found
>>> Caused by:
>>> org.springframework.beans.factory.BeanCreationException: Error
>>> creating bean with name
>>> 'org
>>> .jasig.cas.adaptors.ldap.BindLdapAuthenticationHandler#1416de4'
>>> defined in ServletContext resource [/WEB-INF/
>>> deployerConfigContext.xml]: Initialization of bean failed; nested
>>> exception is org.springframework.beans.TypeMismatchException:
>>> Failed to convert property value of type [java.lang.String] to
>>> required type
>>> [org.jasig.cas.adaptors.ldap.util.AuthenticatedLdapContextSource]
>>> for property 'contextSource'; nested exception is
>>> java.lang.IllegalArgumentException: Cannot convert value of type
>>> [java.lang.String] to required type
>>> [org.jasig.cas.adaptors.ldap.util.AuthenticatedLdapContextSource]
>>> for property 'contextSource': no matching editors or conversion
>>> strategy found
>>> Caused by:
>>> org.springframework.beans.TypeMismatchException: Failed to convert
>>> property value of type [java.lang.String] to required type
>>> [org.jasig.cas.adaptors.ldap.util.AuthenticatedLdapContextSource]
>>> forproperty 'contextSource'; nested exception is
>>> java.lang.IllegalArgumentException: Cannot convert value of type
>>> [java.lang.String] to required type
>>> [org.jasig.cas.adaptors.ldap.util.AuthenticatedLdapContextSource]
>>> for property 'contextSource': no matching editors or conversion
>>> strategy found
>>> Caused by:
>>> java.lang.IllegalArgumentException: Cannot convert value of type
>>> [java.lang.String] to required type
>>> [org.jasig.cas.adaptors.ldap.util.AuthenticatedLdapContextSource]
>>> for property 'contextSource': no matching editors or conversion
>>> strategy found
>>>
>>>
>>> deployerConfigContext.xml:
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <beans xmlns="http://www.springframework.org/schema/beans"
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>> xmlns:p="http://www.springframework.org/schema/p"
>>> xsi:schemaLocation="http://www.springframework.org/schema/beans
>>> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
>>> <bean id="authenticationManager"
>>>
>>> class="org.jasig.cas.authentication.AuthenticationManagerImpl">
>>> <property name="credentialsToPrincipalResolvers">
>>> <list>
>>> <bean
>>> class
>>> =
>>> "org
>>> .jasig
>>> .cas
>>> .authentication
>>> .principal.UsernamePasswordCredentialsToPrincipalResolver" />
>>> <bean
>>> class
>>> =
>>> "org
>>> .jasig
>>> .cas
>>> .authentication
>>> .principal.HttpBasedServiceCredentialsToPrincipalResolver" />
>>> </list>
>>> </property>
>>> <property name="authenticationHandlers">
>>> <list>
>>> <bean
>>> class
>>> =
>>> "org
>>> .jasig
>>> .cas
>>> .authentication
>>> .handler.support.HttpBasedServiceCredentialsAuthenticationHandler"
>>> p:httpClient-ref="httpClient" />
>>> <bean
>>> class="org.jasig.cas.adaptors.ldap.BindLdapAuthenticationHandler">
>>> <property name="filter" value="uid=%u" />
>>> <property name="searchBase"
>>> value="cn=XXXXX,dc=XXXX,dc=XXXX" />
>>> <property name="contextSource"
>>> value="contextSource" />
>>> </bean>
>>> </list>
>>> </property>
>>> </bean>
>>> <bean id="contextSource"
>>> class
>>> ="org.jasig.cas.adpators.ldap.util.AuthenticatedLdapContextSource">
>>> <property name="urls">
>>> <list>
>>> <value>XXXXXXXXXXXXXXXX</value>
>>> </list>
>>> </property>
>>> <property name="userName" value="XXXXXXX" />
>>> <property name="password" value="XXXXXXX" />
>>> <property name="baseEnvironmentProperties">
>>>
>>> <property name="ignorePartialResultException" value="yes" />
>>> <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>
>>> <bean id="userDetailsService"
>>> class="org.acegisecurity.userdetails.memory.InMemoryDaoImpl">
>>> <property name="userMap">
>>> <value>
>>> </value>
>>> </property>
>>> </bean>
>>> <bean id="attributeRepository"
>>>
>>> class="org.jasig.services.persondir.support.StubPersonAttributeDao">
>>> <property name="backingMap">
>>> <map>
>>> <entry key="uid" value="uid" />
>>> </map>
>>> </property>
>>> </bean>
>>> <bean
>>> id="serviceRegistryDao"
>>>
>>> class="org.jasig.cas.services.InMemoryServiceRegistryDaoImpl" />
>>> </beans>
>>> --
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://tp.its.yale.edu/pipermail/cas/attachments/20080111/8f23310b/attachment.html
More information about the cas
mailing list