Hi,
I'm configuring CAS on Jasper server pro (following the document Authentication Cookbook 4.0), but an exception is raised during the instanciation of the bean "ticketCacheManager", which says:
Here the modification made to the 'applicationContext-security.xml' file (patch):
+++ apache-tomcat/webapps/jasperserver-pro/WEB-INF/applicationContext-security.xml 2012-09-28 11:16:41.000000000 +0200
@@ -12,12 +12,58 @@
<property name="providers">
<list>
<!-- not on by default <ref local="ldapAuthenticationProvider"/> -->
- <ref bean="${bean.daoAuthenticationProvider}"/>
+ <!-- CAS -->
+ <ref local="casAuthenticationProvider"/>
+ <!-- /CAS -->
<ref bean="anonymousAuthenticationProvider"/>
<!--ref local="jaasAuthenticationProvider"/-->
</list>
</property>
</bean>
+
+ <!-- CAS -->
+ <bean id="casAuthenticationProvider"
+ class="org.springframework.security.providers.cas.CasAuthenticationProvider">
+ <property name="userDetailsService"><ref local="casUserAuthorityService"/></property>
+ <property name="serviceProperties"><ref local="authenticationServiceProperties"/>
+ </property>
+ <property name="ticketValidator">
+ <bean class="org.jasig.cas.client.validation.Cas20ServiceTicketValidator">
+ <constructor-arg index="0" value="https://cas.example.net/cas" /></bean></property>
+ <property name="statelessTicketCache">
+ <bean class="org.springframework.security.providers.cas.cache.EhCacheBasedTicketCache">
+ <property name="cache"><ref local="ticketCache"/></property></bean></property>
+ <property name="key"><value>lam_or_lame</value></property>
+ </bean>
+
+ <bean id="authenticationServiceProperties"
+ class="org.springframework.security.ui.cas.ServiceProperties">
+ <property name="service">
+ <value>https://jasper.example.net/jasperserver-pro/j_spring_cas_security_check<...
+ <property name="sendRenew"><value>false</value></property>
+ </bean>
+
+ <bean id="ticketCacheManager"
+ class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
+ <property name="configLocation"><value>classpath:/ehcache-failsafe.xml</value></property>
+ </bean>
+
+ <bean id="ticketCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
+ <property name="cacheManager"><ref local="ticketCacheManager"/></property>
+ <property name="cacheName"><value>casTicketCache</value></property>
+ </bean>
+
+ <bean id="casUserAuthorityService"
+ class="com.jaspersoft.jasperserver.api.metadata.user.service.impl.UserDetailsServiceImpl">
+ <property name="adminUsers"><list>
+ <value>my_admin_user</value></list></property>
+ <property name="defaultAdminRoles"><list>
+ <value>ROLE_USER</value>
+ <value>ROLE_ADMINISTRATOR</value></list></property>
+ <property name="defaultInternalRoles"><list>
+ <value>ROLE_USER</value></list></property>
+ </bean>
+ <!-- /CAS -->
<bean id="anonymousAuthenticationProvider" class="org.springframework.security.providers.anonymous.AnonymousAuthenticationProvider">
<property name="key"><value>foobar</value></property>
2 Answers:
Hello Sebastien,
Try making the following changes. First, disable or remove the following bean:
+ <bean id="ticketCacheManager"
+ class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
+ <property name="configLocation"><value>classpath:/ehcache-failsafe.xml</value></property>
+ </bean>
Then change the ticketCache bean to reference cacheManager instead of ticketCacheManager like this:
+ <bean id="ticketCache" class="org.springframework.cache.ehcache.EhCacheFactoryBean">
+ <property name="cacheManager"><ref local="cacheManager"/></property>
+ <property name="cacheName"><value>casTicketCache</value></property>
+ </bean>
If you are using a commercial version, edit applicationContext-multitenancy-web.xml and comment out the bean "adhocUpgradeListener" if you run into a null pointer error related to hibernate after the above changes.
-Kris
Hello,
I don't know if it is related to this (in the case it doesn't, I will create a new question), Jasper Reports is unable to authenticate my user account once the CAS makes the redirection. The user exists in Jasper Reports, and has the same ID used by the CAS.
There is the following output in logs:
22 oct. 2012 18:02:33 org.apache.catalina.core.ApplicationContext log
INFO:
*****************************************************
* Owasp.CsrfGuard Properties
*
* Logger: com.jaspersoft.jasperserver.api.security.JSCsrfLogger
* NewTokenLandingPage: /jasperserver-pro/login.html
* PRNG: SHA1PRNG
* SessionKey: JASPER_CSRF_SESSION_KEY
* TokenLength: 96
* TokenName: JASPER_CSRF_TOKEN
* Ajax: true
* Rotate: true
* TokenPerPage: true
* Action: org.owasp.csrfguard.action.Rotate
* Action: org.owasp.csrfguard.action.Redirect
* Parameter: Page = /jasperserver-pro/login.html
* Action: org.owasp.csrfguard.action.Log
* Parameter: Message = potential cross-site request forgery (CSRF) attack thwarted (user:%user%, ip:%remote_ip%, uri:%request_uri%, error:%exception_messa ge%)
*****************************************************