Announcement Announcement Module
Collapse
No announcement yet.
ACEGI-CAS Redirect Page Title Module
Move Remove Collapse
This topic is closed
X
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • ACEGI-CAS Redirect

    Hi!, I am using ACEGI and CAS in a site I am doing.
    After I login in CAS server It doesn´t redirect to the original page who called the login.

    web.xml
    HTML Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN' 'http://java.sun.com/dtd/web-app_2_3.dtd'>
    
    <web-app>
    
    	<context-param>
    		<param-name>contextConfigLocation</param-name>
    		<param-value>
    			/WEB-INF/security-cas.xml
    		</param-value>
    	</context-param>
    
    	<filter>
    		<filter-name>Acegi CAS Processing Filter</filter-name>
    		<filter-class>
    			org.acegisecurity.util.FilterToBeanProxy
    		</filter-class>
    		<init-param>
    			<param-name>targetClass</param-name>
    			<param-value>
    				org.acegisecurity.util.FilterChainProxy
    			</param-value>
    		</init-param>
    	</filter>
    
    	<filter-mapping>
    		<filter-name>Acegi CAS Processing Filter</filter-name>
    		<url-pattern>/j_acegi_cas_security_check</url-pattern>
    		</filter-mapping>
    	<filter-mapping>
    		<filter-name>Acegi CAS Processing Filter</filter-name>
    		<url-pattern>/*</url-pattern>
    	</filter-mapping>
    
    
    	<listener>
    		<listener-class>
    			org.springframework.web.context.ContextLoaderListener
    		</listener-class>
    	</listener>
    
    	<servlet>
    		<servlet-name>casproxy</servlet-name>
    		<servlet-class>
    			edu.yale.its.tp.cas.proxy.ProxyTicketReceptor
    		</servlet-class>
    	</servlet>
    
    	<servlet-mapping>
    		<servlet-name>casproxy</servlet-name>
    		<url-pattern>/casProxy/*</url-pattern>
    	</servlet-mapping>
    </web-app>
    security-cas.xml
    HTML Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC  "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
    <beans>
    
    
    	<bean id="filterChainProxy"
    		class="org.acegisecurity.util.FilterChainProxy">
    		<property name="filterInvocationDefinitionSource">
    			<value>
    				CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
    				PATTERN_TYPE_APACHE_ANT
    				/**=httpSessionContextIntegrationFilter,anonymousProcessingFilter,casProcessingFilter,exceptionTranslationFilter,filterSecurityInterceptor
    			</value>
    		</property>
    	</bean>
    
    	<bean id="httpSessionContextIntegrationFilter"
    class="org.acegisecurity.context.HttpSessionContextIntegrationFilter" />
    
    	<bean id="serviceProperties"
    		class="org.acegisecurity.ui.cas.ServiceProperties">
    		<property name="service">
    			<value>
    				http://localhost:8080/character-test/j_acegi_cas_security_check
    			</value>
    		</property>
    		<property name="sendRenew">
    			<value>false</value>
    		</property>
    	</bean>
    
    
    	<bean id="casProcessingFilter"
    		class="org.acegisecurity.ui.cas.CasProcessingFilter">
    		<property name="authenticationManager">
    			<ref bean="authenticationManager" />
    		</property>
    		<property name="authenticationFailureUrl">
    			<value>/error.html</value>
    		</property>
    		<property name="defaultTargetUrl">
    			<value>/ok.html</value>
    		</property>
    		<property name="filterProcessesUrl">
    			<value>/error.html</value>
    		</property>
    	</bean>
    
    	<bean id="exceptionTranslationFilter"
    		class="org.acegisecurity.ui.ExceptionTranslationFilter">
    		<property name="authenticationEntryPoint">
    			<ref local="casProcessingFilterEntryPoint" />
    		</property>
    	</bean>
    
    	<bean id="casProcessingFilterEntryPoint"
    		class="org.acegisecurity.ui.cas.CasProcessingFilterEntryPoint">
    		<property name="loginUrl">
    			<value>http://cas.deremate.bue:8080/cas/login</value>
    		</property>
    		<property name="serviceProperties">
    			<ref bean="serviceProperties" />
    		</property>
    	</bean>
    
    	<bean id="authenticationManager"
    		class="org.acegisecurity.providers.ProviderManager">
    		<property name="providers">
    			<list>
    				<ref bean="casAuthenticationProvider" />
    			</list>
    		</property>
    	</bean>
    
    	<bean id="casAuthenticationProvider"
    		class="org.acegisecurity.providers.cas.CasAuthenticationProvider">
    		<property name="casAuthoritiesPopulator">
    			<ref bean="casAuthoritiesPopulator" />
    		</property>
    		<property name="casProxyDecider">
    			<ref bean="casProxyDecider" />
    		</property>
    		<property name="ticketValidator">
    			<ref bean="casProxyTicketValidator" />
    		</property>
    		<property name="statelessTicketCache">
    			<ref bean="statelessTicketCache" />
    		</property>
    		<property name="key">
    			<value>my_password_for_this_auth_provider_only</value>
    		</property>
    	</bean>
    
    	<bean id="casProxyDecider"
    		class="org.acegisecurity.providers.cas.proxy.RejectProxyTickets" />
    
    	<bean id="casProxyTicketValidator"
    		class="org.acegisecurity.providers.cas.ticketvalidator.CasProxyTicketValidator">
    		<property name="casValidate">
    			<value>http://cas.deremate.bue:8080/cas/proxyValidate</value>
    		</property>
    		<property name="proxyCallbackUrl">
    			<value>
    				http://localhost:8080/character-test/casProxy/receptor
    			</value>
    		</property>
    		<property name="serviceProperties">
    			<ref bean="serviceProperties" />
    		</property>
    		<!--  <property name="trustStore"><value>%JAVA_HOME%\jre\lib\security\cacerts</value></property>-->
    	</bean>
    
    	<!-- bean id="cacheManager"
    		class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
    		<property name="configLocation">
    			<value>classpath:/ehcache-failsafe.xml</value>
    		</property>
    	</bean-->
    
       <bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"/>
    
    	<bean id="ticketCacheBackend"
    		class="org.springframework.cache.ehcache.EhCacheFactoryBean">
    		<property name="cacheManager">
    			<ref local="cacheManager" />
    		</property>
    		<property name="cacheName">
    			<value>ticketCache</value>
    		</property>
    	</bean>
    
    	<bean id="statelessTicketCache"
    		class="org.acegisecurity.providers.cas.cache.EhCacheBasedTicketCache">
    		<property name="cache">
    			<ref local="ticketCacheBackend" />
    		</property>
    	</bean>
    
    	<bean id="casAuthoritiesPopulator"
    		class="org.acegisecurity.providers.cas.populator.DaoCasAuthoritiesPopulator">
    		<property name="userDetailsService">
    			<ref bean="jdbcDaoImpl" />
    		</property>
    	</bean>
    	<bean id="filterSecurityInterceptor"
    		class="org.acegisecurity.intercept.web.FilterSecurityInterceptor">
    		<property name="authenticationManager">
    			<ref bean="authenticationManager" />
    		</property>
    		<property name="accessDecisionManager">
    			<ref bean="accessDecisionManager" />
    		</property>
    		<property name="objectDefinitionSource">
    			<value>
    				CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
    				PATTERN_TYPE_APACHE_ANT
    				/secure/**=ROLE_USER
    			</value>
    		</property>
    	</bean>
    
    	<bean id="accessDecisionManager"
    		class="org.acegisecurity.vote.UnanimousBased">
    
    		<property name="allowIfAllAbstainDecisions">
    			<value>false</value>
    		</property>
    		<property name="decisionVoters">
    			<list>
    				<ref local="roleVoter" />
    			</list>
    		</property>
    	</bean>
    
    	<bean id="roleVoter" class="org.acegisecurity.vote.RoleVoter">
    		<property name="rolePrefix">
    			<value>ROLE_</value>
    		</property>
    	</bean>
    
    	<bean id="anonymousProcessingFilter" class="org.acegisecurity.providers.anonymous.AnonymousProcessingFilter">
    		<property name="key" value="changeThis"/>
    		<property name="userAttribute" value="anonymousUser,ROLE_ANONYMOUS"/>
    	</bean>
    
    
    	<bean id="jdbcDaoImpl" class="org.acegisecurity.userdetails.jdbc.JdbcDaoImpl">
    	  <property name="dataSource"><ref bean="dataSource"/></property>
    	  	<property name="usersByUsernameQuery">
    				<value>SELECT NICK AS USERNAME, PWD AS PASSWORD, CASE WHEN (Stat &lt; 4) THEN 1 ELSE 0 END AS ENABLED FROM IDDB WHERE NICK = ?</value>
    			</property>
    	  	<property name="authoritiesByUsernameQuery">
    				<value>SELECT NICK AS USERNAME, 'ROLE_USER' AS AUTHORITY FROM IDDB WHERE NICK = ?</value>
    			</property>
    	</bean>
    
    	<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    		<property name="driverClassName">
    			<value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
    		</property>
    		<property name="url">
    			<value>jdbc:microsoft:sqlserver://sql:1433;DatabaseName=auc</value>
    		</property>
    		<property name="username">
    			<value>sa</value>
    		</property>
    		<property name="password">
    			<value>sa</value>
    		</property>
    	</bean>
    
    </beans>
    Does anyone has an idea what is happening?
    Thanks!

  • #2
    Here is my CAS Server configuration

    CAS Server - deployerConfigContext.xml
    HTML Code:
    <?xml version="1.0" encoding="UTF-8"?>
    	<!DOCTYPE beans PUBLIC  "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
    	<beans>
    		<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" />
    					<bean class="org.acegisecurity.adapters.cas3.CasAuthenticationHandler">
    						<property name="authenticationManager" ref="acegiAuthenticationManager" />
    					</bean>
    				</list>
    			</property>
    		</bean>
    
    	
    		<bean id="acegiAuthenticationManager" class="org.acegisecurity.providers.ProviderManager">
    			<property name="providers">
    			  <list>
    			    <ref bean="daoAuthenticationProvider"/>
    			  </list>
    			</property>
    		</bean>
    
    		<bean id="daoAuthenticationProvider" class="org.acegisecurity.providers.dao.DaoAuthenticationProvider">
    	     	<property name="userDetailsService"><ref bean="jdbcDaoImpl"/></property>
    		</bean>
    		
    		<bean id="jdbcDaoImpl" class="org.acegisecurity.userdetails.jdbc.JdbcDaoImpl">
    		  <property name="dataSource"><ref bean="dataSource"/></property>
    		  	<property name="usersByUsernameQuery">
    					<value>SELECT NICK AS USERNAME, PWD AS PASSWORD, CASE WHEN (Stat &lt; 4) THEN 1 ELSE 0 END AS ENABLED FROM IDDB WHERE NICK = ?</value>
    				</property>
    		  	<property name="authoritiesByUsernameQuery">
    					<value>SELECT NICK AS USERNAME, 'ROLE_USER' AS AUTHORITY FROM IDDB WHERE NICK = ?</value>
    				</property>
    		</bean>
    
    	<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    		<property name="driverClassName">
    			<value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
    		</property>
    		<property name="url">
    			<value>jdbc:microsoft:sqlserver://sql:1433;DatabaseName=auc</value>
    		</property>
    		<property name="username">
    			<value>sa</value>
    		</property>
    		<property name="password">
    			<value>sa</value>
    		</property>
    	</bean>
    	
    	
    </beans>

    Comment


    • #3
      did you modify your CAS JSP pages at all?

      Comment


      • #4
        witch kind of modification should I do?

        Comment


        • #5
          solution

          I found the error, as incredible as it sound it was spaces

          I change from this:
          HTML Code:
          	<bean id="serviceProperties"
          		class="org.acegisecurity.ui.cas.ServiceProperties">
          		<property name="service">
          			<value>
          				http://localhost:8080/character-test/j_acegi_cas_security_check
          			</value>
          		</property>
          		<property name="sendRenew">
          			<value>false</value>
          		</property>
          	</bean>
          to this
          HTML Code:
          	<bean id="serviceProperties"
          		class="org.acegisecurity.ui.cas.ServiceProperties">
          		<property name="service">
          			<value>http://localhost:8080/character-test/j_acegi_cas_security_check</value>
          		</property>
          		<property name="sendRenew">
          			<value>false</value>
          		</property>
          	</bean>
          and it works perfect, look out with the java formatter in Eclipse!!

          Regards!

          Comment


          • #6
            Hello,

            I try to develop a similar application. But, I have the following problem which is in this post :

            http://forum.springframework.org/showthread.php?t=37531

            Can you help me ? Why it doesn't find the j_acegi_cas_security_check filter ?

            Thanks for yours answers.
            Last edited by rc_29; Apr 23rd, 2007, 09:59 AM.

            Comment

            Working...
            X