Hi,
 
I have not added any "CredentialsToPrincipalResolver". 
 
I am just paasing the Username and Password credentials to AD through LDAP.
 
I have attached the deployer config file above.
 
Thanks

--- On Sun, 2/14/10, Scott Battaglia <scott.battag...@gmail.com> wrote:


From: Scott Battaglia <scott.battag...@gmail.com>
Subject: Re: [cas-user] CAS Active Directory LDAP Support
To: cas-user@lists.jasig.org
Date: Sunday, February 14, 2010, 7:20 PM


What type of credentials are you passing in?  Did you add an appropriate 
CredentialsToPrincipalResolver?



On Fri, Feb 12, 2010 at 1:16 AM, Maina Watare <mwat...@yahoo.com> wrote:






Thanks Scott. The class error is gone with your advice.
 
I get the message "The credentials you provided are not supported by CAS" what 
am i not doing right...



--- On Thu, 2/11/10, Scott Battaglia <scott.battag...@gmail.com> wrote:



From: Scott Battaglia <scott.battag...@gmail.com>
Subject: Re: [cas-user] CAS Active Directory LDAP Support
To: cas-user@lists.jasig.org
Date: Thursday, February 11, 2010, 9:41 PM 





Please re-read that LDAP page. There are a few points on it where it says after 
3.3.2 you need to use the LdapContextSource included with Spring LDAP.



On Fri, Feb 12, 2010 at 12:27 AM, Maina Watare <mwat...@yahoo.com> wrote:






Thanks for your reply.
I am using CAS 3.3.5.

--- On Thu, 2/11/10, Scott Battaglia <scott.battag...@gmail.com> wrote:


From: Scott Battaglia <scott.battag...@gmail.com>
Subject: Re: [cas-user] CAS Active Directory LDAP Support
To: cas-user@lists.jasig.org
Date: Thursday, February 11, 2010, 8:51 AM





You don't mention which CAS you're using.   If you're using the most recent 
version of CAS check that LDAP page for the alternative to 
AuthenticatedLdapContextSource


-Scott Battaglia
PGP Public Key Id: 0x383733AA
LinkedIn: http://www.linkedin.com/in/scottbattaglia



On Thu, Feb 11, 2010 at 10:43 AM, Maina Watare <mwat...@yahoo.com> wrote:







Hi All,I am a newbie on CAS.I want to get CAS to authenticate against Active 
Directory username/password
I have been following the article on 
http://www.ja-sig.org/wiki/display/CASUM/LDAP with little success.My Setup is 
1. Tomcat 6.02. apache-maven-2.2.13. Windows Xp4. AD Ms Win 2008Currently i am 
getting the following errors on the Tomcat log fileused by: 
org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find 
class [org.jasig.cas.adaptors.ldap.util.AuthenticatedLdapContextSource] for 
bean with name 'contextSource' defined in ServletContext resource 
[/WEB-INF/deployerConfigContext.xml]; nested exception is 
java.lang.ClassNotFoundException: 
org.jasig.cas.adaptors.ldap.util.AuthenticatedLdapContextSource






 at 
org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1141)
 at
 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:524)
 at 
org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1177)






 at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:222)
 at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:303)






 at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:297)
 at 
org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:941)






 at 
org.jasig.cas.util.AutowiringSchedulerFactoryBean.afterPropertiesSet(AutowiringSchedulerFactoryBean.java:31)
 at
 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369)
 at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)






 ... 40 more
Caused by: java.lang.ClassNotFoundException: 
org.jasig.cas.adaptors.ldap.util.AuthenticatedLdapContextSource
 at 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1484)
 at 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1329)






 at org.springframework.util.ClassUtils.forName(ClassUtils.java:211)
 at 
org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:385)
 at 
org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1138)






 ... 49
 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.
org.springframework.beans.factory.BeanCreationException: Error creating bean 
with name 'scheduler' defined in ServletContext resource 
[/WEB-INF/spring-configuration/applicationContext.xml]: Invocation of init 
method failed; nested exception is 
org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find 
class [org.jasig.cas.adaptors.ldap.util.AuthenticatedLdapContextSource] for 
bean with name 'contextSource' defined in ServletContext resource 
[/WEB-INF/deployerConfigContext.xml]; nested exception is 
java.lang.ClassNotFoundException: 
org.jasig.cas.adaptors.ldap.util.AuthenticatedLdapContextSource






 at
 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
 at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)






 at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
 at java.security.AccessController.doPrivileged(Native Method)
 at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)






 at 
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
 at 
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)






 at
 
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
 at 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
 at 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)






 at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423)
 at 
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)






 at 
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
 at 
org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)





 at 
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)

 at
 
org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
 at 
org.jasig.cas.web.init.SafeContextLoaderListener.contextInitialized(SafeContextLoaderListener.java:62)
 at 
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)






 at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
 at 
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
 at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)






 at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)
 at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:905)
 at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:740)






 at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:500)
 at
 org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
 at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
 at 
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)






 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
 at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)






 at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
 at org.apache.catalina.core.StandardService.start(StandardService.java:516)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)






 at org.apache.catalina.startup.Catalina.start(Catalina.java:593)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown
 Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)






Caused by: org.springframework.beans.factory.CannotLoadBeanClassException: 
Cannot find class 
[org.jasig.cas.adaptors.ldap.util.AuthenticatedLdapContextSource] for bean with 
name 'contextSource' defined in ServletContext resource 
[/WEB-INF/deployerConfigContext.xml]; nested exception is 
java.lang.ClassNotFoundException: 
org.jasig.cas.adaptors.ldap.util.AuthenticatedLdapContextSource






 at 
org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1141)
 at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:524)






 at
 
org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1177)
 at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:222)






 at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:303)
 at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:297)






 at 
org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:941)
 at 
org.jasig.cas.util.AutowiringSchedulerFactoryBean.afterPropertiesSet(AutowiringSchedulerFactoryBean.java:31)






 at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369)
 at
 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
 ... 40 more
Caused by: java.lang.ClassNotFoundException: 
org.jasig.cas.adaptors.ldap.util.AuthenticatedLdapContextSource






 at 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1484)
 at 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1329)
 at org.springframework.util.ClassUtils.forName(ClassUtils.java:211)






 at 
org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:385)
 at 
org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1138)






 ... 49 more Please Help..Thanks ,Watare
-- 
You are currently subscribed to cas-user@lists.jasig.org as: 
scott.battag...@gmail.com






To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/cas-user
-- 
You are currently subscribed to cas-user@lists.jasig.org as: mwat...@yahoo.com




To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/cas-user



-- 
You are currently subscribed to cas-user@lists.jasig.org as: 
scott.battag...@gmail.com




To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/cas-user
-- 
You are currently subscribed to cas-user@lists.jasig.org as: mwat...@yahoo.com


To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/cas-user



-- 
You are currently subscribed to cas-user@lists.jasig.org as: 
scott.battag...@gmail.com


To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/cas-user
-- 
You are currently subscribed to cas-user@lists.jasig.org as: mwat...@yahoo.com
To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/cas-user


      
-- 
You are currently subscribed to cas-user@lists.jasig.org as: 
arch...@mail-archive.com
To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/cas-user
<?xml version="1.0" encoding="UTF-8"?>
<!--
	| deployerConfigContext.xml centralizes into one file some of the declarative configuration that
	| all CAS deployers will need to modify.
	|
	| This file declares some of the Spring-managed JavaBeans that make up a CAS deployment.  
	| The beans declared in this file are instantiated at context initialization time by the Spring 
	| ContextLoaderListener declared in web.xml.  It finds this file because this
	| file is among those declared in the context parameter "contextConfigLocation".
	|
	| By far the most common change you will need to make in this file is to change the last bean
	| declaration to replace the default SimpleTestUsernamePasswordAuthenticationHandler with
	| one implementing your approach for authenticating usernames and passwords.
	+-->
<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";>
	<!--
		| This bean declares our AuthenticationManager.  The CentralAuthenticationService service bean
		| declared in applicationContext.xml picks up this AuthenticationManager by reference to its id, 
		| "authenticationManager".  Most deployers will be able to use the default AuthenticationManager
		| implementation and so do not need to change the class of this bean.  We include the whole
		| AuthenticationManager here in the userConfigContext.xml so that you can see the things you will
		| need to change in context.
		+-->
  <bean id="contextSource"
  class="org.springframework.ldap.core.support.LdapContextSource">
    <property name="pooled" value="true"/>
    <property name="urls">
      <list>
           <value>ldap://firstservername:636</value>
        <value>ldap://secondservername:636</value>
        <value>ldap://thirdservername:636</value>
        <value>ldap://fourthservername:636</value>
      </list>
    </property>
    <property name="userDn" value="cn=Administrator,CN=Users,DC=DELETED,DC=org"/>
    <property name="password" value="DELETED"/>
    <property name="baseEnvironmentProperties">
      <map>
        <entry key="java.naming.security.authentication" value="simple" />
      </map>
    </property>
  </bean>
	<bean id="authenticationManager"
		class="org.jasig.cas.authentication.AuthenticationManagerImpl">
		<!--
			| 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" />
				<!--
					| 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>

		<!--
			| Whereas CredentialsToPrincipalResolvers identify who it is some Credentials might authenticate, 
			| AuthenticationHandlers actually authenticate credentials.  Here we declare the AuthenticationHandlers that
			| authenticate the Principals that the CredentialsToPrincipalResolvers identified.  CAS will try these handlers in turn
			| until it finds one that both supports the Credentials presented and succeeds in authenticating.
			+-->
		<property name="authenticationHandlers">
			<list>
				<!--
					| This is the authentication handler that authenticates services by means of callback via SSL, thereby validating
					| a server side SSL certificate.
					+-->
				<bean class="org.jasig.cas.authentication.handler.support.HttpBasedServiceCredentialsAuthenticationHandler"
					p:httpClient-ref="httpClient" />
				<!--
					| This is the authentication handler declaration that every CAS deployer will need to change before deploying CAS 
					| into production.  The default SimpleTestUsernamePasswordAuthenticationHandler authenticates UsernamePasswordCredentials
					| where the username equals the password.  You will need to replace this with an AuthenticationHandler that implements your
					| local authentication strategy.  You might accomplish this by coding a new such handler and declaring
					| edu.someschool.its.cas.MySpecialHandler here, or you might use one of the handlers provided in the adaptors modules.
					+-->
				<!--<bean
					class="org.jasig.cas.authentication.handler.support.SimpleTestUsernamePasswordAuthenticationHandler" />-->
        <!--<bean class="org.jasig.cas.adaptors.generic.AcceptUsersAuthenticationHandler">
          <property name="users">
            <map>
              <entry>
                <key>
                  <value>scott</value>
                </key>
                <value>secret</value>
              </entry>
            </map>
          </property>
        </bean>-->
        </list>
      </property>
    </bean>
        <bean class="org.jasig.cas.adaptors.ldap.BindLdapAuthenticationHandler">
          <property name="filter" value="sAMAccountName=%u" />
          <property name="searchBase" value="CN=Users,DC=DELETED,DC=org" />
          <property name="contextSource" ref="contextSource" />
          <property name="ignorePartialResultException" value="yes" />
          <!-- fix because of how AD returns results -->
        </bean>

	<!--
	This bean defines the security roles for the Services Management application.  Simple deployments can use the in-memory version.
	More robust deployments will want to use another option, such as the Jdbc version.
	
	The name of this should remain "userDetailsService" in order for Acegi to find it. 
	
	To use this, you should add an entry similar to the following between the two value tags:
	battags=notused,ROLE_ADMIN
	
	where battags is the username you want to grant access to.  You can put one entry per line.
	 -->	
	<bean id="userDetailsService" class="org.springframework.security.userdetails.memory.InMemoryDaoImpl">
		<property name="userMap">
			<value>
			
		    </value>
		</property>
	</bean> 
	
	<!-- 
	Bean that defines the attributes that a service may return.  This example uses the Stub/Mock version.  A real implementation
	may go against a database or LDAP server.  The id should remain "attributeRepository" though.
	 -->
	<bean id="attributeRepository"
		class="org.jasig.services.persondir.support.StubPersonAttributeDao">
		<property name="backingMap">
			<map>
				<entry key="uid" value="uid" />
				<entry key="eduPersonAffiliation" value="eduPersonAffiliation" /> 
				<entry key="groupMembership" value="groupMembership" />
			</map>
		</property>
	</bean>
	
	<!-- 
	Sample, in-memory data store for the ServiceRegistry. A real implementation
	would probably want to replace this with the JPA-backed ServiceRegistry DAO
	The name of this bean should remain "serviceRegistryDao".
	 -->
	<bean
		id="serviceRegistryDao"
		class="org.jasig.cas.services.InMemoryServiceRegistryDaoImpl" />
</beans>

Reply via email to