title: Getting stuck in redirection loop after successful login in Java cas client
body: <p>I have given past one month to CAS server and CAS client as well but not get proper solution for my application yet, Please help.</p>
  
  <p>Here is my brief explanation:-</p>
  
  <p>I have two applications, one in Java and other is in ROR. I have setup CAS SERVER in JAVA, I am using self-signed certificate for CAS server and it is working well.</p>
  
  <p>ROR application:- Installed RubyCAS-client and it is also working well. </p>
  
  <p>I am facing problem in JAVA cas client. I have tried this on http and https both but every time it stuck in the redirection loop. My application(client) has started but no information is publishing in the logs on the other hand CAS server  issued 11 tickets every time. here is the log:</p>
  
  <pre><code>2014-03-01 00:50:02,540 INFO [org.jasig.cas.authentication.AuthenticationManagerImpl] -  &lt;AuthenticationHandler: org.jasig.cas.adaptors.jdbc.QueryDatabaseAuthenticationHandler successfully authenticated the user which provided the following credentials: [username: ankit@yopmail.com]&gt;
  2014-03-01 00:50:02,574 INFO [org.jasig.cas.CentralAuthenticationServiceImpl] - &lt;Granted service ticket [ST-1-h6DqHWTp273M0N3IQTC5-localhost] for service [https://localhost:8444/Testing/j_spring_cas_security_check] for user [ankit@yopmail.com]&gt;
  2014-03-01 00:50:02,606 INFO [org.jasig.cas.CentralAuthenticationServiceImpl] - &lt;Granted service ticket [ST-2-Qh2p1wolMX3j2UcVVeaF-localhost] for service [https://localhost:8444/Testing/j_spring_cas_security_check] for user [ankit@yopmail.com]&gt;
  2014-03-01 00:50:02,617 INFO [org.jasig.cas.CentralAuthenticationServiceImpl] - &lt;Granted service ticket [ST-3-LiZI7QvcB43bKQiwi3xs-localhost] for service [https://localhost:8444/Testing/j_spring_cas_security_check] for user [ankit@yopmail.com]&gt;
  2014-03-01 00:50:02,630 INFO [org.jasig.cas.CentralAuthenticationServiceImpl] - &lt;Granted service ticket [ST-4-QaXXQFaBc3CUIBJR1Woe-localhost] for service [https://localhost:8444/Testing/j_spring_cas_security_check] for user [ankit@yopmail.com]&gt;
  2014-03-01 00:50:02,645 INFO [org.jasig.cas.CentralAuthenticationServiceImpl] - &lt;Granted service ticket [ST-5-cRQHG2R4nZpM3ezooIEf-localhost] for service [https://localhost:8444/Testing/j_spring_cas_security_check] for user [ankit@yopmail.com]&gt;
  2014-03-01 00:50:02,675 INFO [org.jasig.cas.CentralAuthenticationServiceImpl] - &lt;Granted service ticket [ST-6-6e5UloJAcWVZjcc50q75-localhost] for service [https://localhost:8444/Testing/j_spring_cas_security_check] for user [ankit@yopmail.com]&gt;
  2014-03-01 00:50:02,687 INFO [org.jasig.cas.CentralAuthenticationServiceImpl] - &lt;Granted service ticket [ST-7-5p3xSzrmkti5NkywLHfY-localhost] for service [https://localhost:8444/Testing/j_spring_cas_security_check] for user [ankit@yopmail.com]&gt;
  2014-03-01 00:50:02,699 INFO [org.jasig.cas.CentralAuthenticationServiceImpl] - &lt;Granted service ticket [ST-8-fIDLeujFBsT9c0ftx4iR-localhost] for service [https://localhost:8444/Testing/j_spring_cas_security_check] for user [ankit@yopmail.com]&gt;
  2014-03-01 00:50:02,710 INFO [org.jasig.cas.CentralAuthenticationServiceImpl] - &lt;Granted service ticket [ST-9-x1sldmLaHMe9bfhbNwEX-localhost] for service [https://localhost:8444/Testing/j_spring_cas_security_check] for user [ankit@yopmail.com]&gt;
  2014-03-01 00:50:02,734 INFO [org.jasig.cas.CentralAuthenticationServiceImpl] - &lt;Granted service ticket [ST-10-vaGd3Obh9sBeKDDJoHPf-localhost] for service [https://localhost:8444/Testing/j_spring_cas_security_check] for user [ankit@yopmail.com]&gt;
  2014-03-01 00:50:02,745 INFO [org.jasig.cas.CentralAuthenticationServiceImpl] - &lt;Granted service ticket [ST-11-5mnVJS4AabPKx2vXxrWy-localhost] for service [https://localhost:8444/Testing/j_spring_cas_security_check] for user [ankit@yopmail.com]&gt;
  </code></pre>
  
  <p>now my problem is I am not redirecting on the destination properly. Here is my application-security-context.xml file:-</p>
  
  <pre><code>&lt;security:global-method-security secured-annotations="disabled"&gt;&lt;/security:global-method-security&gt;
  &lt;security:http auto-config="false" entry-point-ref="casAuthenticationEntryPoint"&gt;
  &lt;security:intercept-url pattern="/js/**" access="IS_AUTHENTICATED_ANONYMOUSLY"/&gt;
  &lt;security:intercept-url pattern="/css/**" access="IS_AUTHENTICATED_ANONYMOUSLY"/&gt;
  &lt;security:intercept-url pattern="/img/**" access="IS_AUTHENTICATED_ANONYMOUSLY"/&gt;
  &lt;security:intercept-url pattern="/emailtemplate/**" access="IS_AUTHENTICATED_ANONYMOUSLY"/&gt;
  
  &lt;security:intercept-url pattern="/index.jsp" access="IS_AUTHENTICATED_ANONYMOUSLY"/&gt;
  &lt;security:intercept-url pattern="/p/**" access="IS_AUTHENTICATED_ANONYMOUSLY"/&gt;
  &lt;security:intercept-url pattern="/dashboard" access="ROLE_USER, ROLE_ADMIN"/&gt;
  &lt;security:intercept-url pattern="/admin/**" access="ROLE_ADMIN"/&gt;
  &lt;security:intercept-url pattern="/user/**" access="ROLE_USER"/&gt;
  
  &lt;security:intercept-url pattern="/**" access="ROLE_USER, ROLE_ADMIN"/&gt;
  &lt;security:custom-filter after="CAS_FILTER" ref="casAuthenticationFilter"/&gt;
  &lt;security:logout logout-success-url="/login"/&gt;
  
  &lt;/security:http&gt;
  
  &lt;bean id="successHandler" class="com.testing.security.AuthenticationSuccessHandler"&gt;
  &lt;property name="defaultTargetUrl" value="/dashboard"/&gt;
  &lt;/bean&gt;
  &lt;bean id="failureHandler" class="org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler"&gt;
  &lt;property name="defaultFailureUrl" value="/login"/&gt;
  &lt;/bean&gt;
  
  &lt;security:authentication-manager alias="authenticationManager"&gt;
  &lt;security:authentication-provider ref="casAuthenticationProvider"/&gt;
  &lt;/security:authentication-manager&gt;
  &lt;bean id="serviceProperties" class="org.springframework.security.cas.ServiceProperties"&gt;
  &lt;property name="service" value="https://localhost:8444/Testing/j_spring_cas_security_check"/&gt;
  
    &lt;property name="sendRenew" value="false"&gt;&lt;/property&gt; 
  
  &lt;/bean&gt;
  
  &lt;bean id="casAuthenticationFilter" class="org.springframework.security.cas.web.CasAuthenticationFilter"&gt;
  &lt;property name="authenticationManager" ref="authenticationManager"/&gt;
  &lt;property name="filterProcessesUrl" value="https://localhost:8444/Testing/j_spring_cas_security_check" /&gt;
      &lt;property name="authenticationSuccessHandler"&gt;
         &lt;bean class="org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler"
           p:alwaysUseDefaultTargetUrl="true"
           p:defaultTargetUrl="/dashboard"/&gt;
  </code></pre>
  
  <p>
         
             
                 
             
         
         </p>
  
  <pre><code>&lt;bean id="casAuthenticationEntryPoint" class="org.springframework.security.cas.web.CasAuthenticationEntryPoint"&gt;
  &lt;property name="loginUrl" value="https://localhost:8443/casserver3421/login"/&gt;
  
  &lt;property name="serviceProperties" ref="serviceProperties"/&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>&lt;bean id="casAuthenticationProvider" class="org.springframework.security.cas.authentication.CasAuthenticationProvider"&gt;
  &lt;property name="userDetailsService" ref="userDetailsService"/&gt;
  &lt;property name="serviceProperties" ref="serviceProperties"/&gt;
  &lt;property name="ticketValidator"&gt;
  &lt;bean class="org.jasig.cas.client.validation.Cas20ServiceTicketValidator"&gt;
  &lt;constructor-arg index="0" value="https://localhost:8443/casserver3421"/&gt;
  &lt;/bean&gt;
  &lt;/property&gt;
  &lt;property name="key" value="my_password_for_this_auth_provider_only"/&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>please help. Thanks in advance.</p>