成功登录Java cas客户端后陷入重定向循环

成功登录Java cas客户端后陷入重定向循环,java,spring-mvc,spring-security,cas,Java,Spring Mvc,Spring Security,Cas,我已经给了过去一个月的CAS服务器和CAS客户端以及,但还没有得到适当的解决方案,为我的应用程序,请帮助 <bean id="casAuthenticationEntryPoint" class="org.springframework.security.cas.web.CasAuthenticationEntryPoint"> <property name="loginUrl" value="https://localhost:8443/casserver3421/login

我已经给了过去一个月的CAS服务器和CAS客户端以及,但还没有得到适当的解决方案,为我的应用程序,请帮助

<bean id="casAuthenticationEntryPoint" class="org.springframework.security.cas.web.CasAuthenticationEntryPoint">
<property name="loginUrl" value="https://localhost:8443/casserver3421/login"/>

<property name="serviceProperties" ref="serviceProperties"/>
以下是我的简要说明:-

<bean id="casAuthenticationEntryPoint" class="org.springframework.security.cas.web.CasAuthenticationEntryPoint">
<property name="loginUrl" value="https://localhost:8443/casserver3421/login"/>

<property name="serviceProperties" ref="serviceProperties"/>
我有两个应用程序,一个是Java,另一个是ROR。我已经用JAVA安装了CAS服务器,我正在为CAS服务器使用自签名证书,它运行良好

<bean id="casAuthenticationEntryPoint" class="org.springframework.security.cas.web.CasAuthenticationEntryPoint">
<property name="loginUrl" value="https://localhost:8443/casserver3421/login"/>

<property name="serviceProperties" ref="serviceProperties"/>
ROR应用程序:-安装了RubyCAS客户端,并且运行良好

<bean id="casAuthenticationEntryPoint" class="org.springframework.security.cas.web.CasAuthenticationEntryPoint">
<property name="loginUrl" value="https://localhost:8443/casserver3421/login"/>

<property name="serviceProperties" ref="serviceProperties"/>
我在JAVA cas客户机中面临问题。我在http和https上都试过,但每次都卡在重定向循环中。我的应用程序(客户端)已启动,但没有在日志中发布任何信息。另一方面,CAS服务器每次发出11个票证。以下是日志:

2014-03-01 00:50:02,540 INFO [org.jasig.cas.authentication.AuthenticationManagerImpl] -  <AuthenticationHandler: org.jasig.cas.adaptors.jdbc.QueryDatabaseAuthenticationHandler successfully authenticated the user which provided the following credentials: [username: ankit@yopmail.com]>
2014-03-01 00:50:02,574 INFO [org.jasig.cas.CentralAuthenticationServiceImpl] - <Granted service ticket [ST-1-h6DqHWTp273M0N3IQTC5-localhost] for service [https://localhost:8444/Testing/j_spring_cas_security_check] for user [ankit@yopmail.com]>
2014-03-01 00:50:02,606 INFO [org.jasig.cas.CentralAuthenticationServiceImpl] - <Granted service ticket [ST-2-Qh2p1wolMX3j2UcVVeaF-localhost] for service [https://localhost:8444/Testing/j_spring_cas_security_check] for user [ankit@yopmail.com]>
2014-03-01 00:50:02,617 INFO [org.jasig.cas.CentralAuthenticationServiceImpl] - <Granted service ticket [ST-3-LiZI7QvcB43bKQiwi3xs-localhost] for service [https://localhost:8444/Testing/j_spring_cas_security_check] for user [ankit@yopmail.com]>
2014-03-01 00:50:02,630 INFO [org.jasig.cas.CentralAuthenticationServiceImpl] - <Granted service ticket [ST-4-QaXXQFaBc3CUIBJR1Woe-localhost] for service [https://localhost:8444/Testing/j_spring_cas_security_check] for user [ankit@yopmail.com]>
2014-03-01 00:50:02,645 INFO [org.jasig.cas.CentralAuthenticationServiceImpl] - <Granted service ticket [ST-5-cRQHG2R4nZpM3ezooIEf-localhost] for service [https://localhost:8444/Testing/j_spring_cas_security_check] for user [ankit@yopmail.com]>
2014-03-01 00:50:02,675 INFO [org.jasig.cas.CentralAuthenticationServiceImpl] - <Granted service ticket [ST-6-6e5UloJAcWVZjcc50q75-localhost] for service [https://localhost:8444/Testing/j_spring_cas_security_check] for user [ankit@yopmail.com]>
2014-03-01 00:50:02,687 INFO [org.jasig.cas.CentralAuthenticationServiceImpl] - <Granted service ticket [ST-7-5p3xSzrmkti5NkywLHfY-localhost] for service [https://localhost:8444/Testing/j_spring_cas_security_check] for user [ankit@yopmail.com]>
2014-03-01 00:50:02,699 INFO [org.jasig.cas.CentralAuthenticationServiceImpl] - <Granted service ticket [ST-8-fIDLeujFBsT9c0ftx4iR-localhost] for service [https://localhost:8444/Testing/j_spring_cas_security_check] for user [ankit@yopmail.com]>
2014-03-01 00:50:02,710 INFO [org.jasig.cas.CentralAuthenticationServiceImpl] - <Granted service ticket [ST-9-x1sldmLaHMe9bfhbNwEX-localhost] for service [https://localhost:8444/Testing/j_spring_cas_security_check] for user [ankit@yopmail.com]>
2014-03-01 00:50:02,734 INFO [org.jasig.cas.CentralAuthenticationServiceImpl] - <Granted service ticket [ST-10-vaGd3Obh9sBeKDDJoHPf-localhost] for service [https://localhost:8444/Testing/j_spring_cas_security_check] for user [ankit@yopmail.com]>
2014-03-01 00:50:02,745 INFO [org.jasig.cas.CentralAuthenticationServiceImpl] - <Granted service ticket [ST-11-5mnVJS4AabPKx2vXxrWy-localhost] for service [https://localhost:8444/Testing/j_spring_cas_security_check] for user [ankit@yopmail.com]>
<bean id="casAuthenticationEntryPoint" class="org.springframework.security.cas.web.CasAuthenticationEntryPoint">
<property name="loginUrl" value="https://localhost:8443/casserver3421/login"/>

<property name="serviceProperties" ref="serviceProperties"/>
2014-03-01 00:50:02540信息[org.jasig.cas.authentication.AuthenticationManagerImpl]-
2014-03-01 00:50:02574信息[org.jasig.cas.centralauthenticationserviceinpl]-
2014-03-01 00:50:02606信息[org.jasig.cas.centralauthenticationserviceinpl]-
2014-03-01 00:50:02617信息[org.jasig.cas.centralauthenticationserviceinpl]-
2014-03-01 00:50:02630信息[org.jasig.cas.centralauthenticationserviceinpl]-
2014-03-01 00:50:02645信息[org.jasig.cas.centralauthenticationserviceinpl]-
2014-03-01 00:50:02675信息[org.jasig.cas.centralauthenticationserviceinpl]-
2014-03-01 00:50:02687信息[org.jasig.cas.centralauthenticationserviceinpl]-
2014-03-01 00:50:02699信息[org.jasig.cas.centralauthenticationserviceinpl]-
2014-03-01 00:50:02710信息[org.jasig.cas.centralauthenticationserviceinpl]-
2014-03-01 00:50:02734信息[org.jasig.cas.centralauthenticationserviceinpl]-
2014-03-01 00:50:02745信息[org.jasig.cas.centralauthenticationserviceinpl]-
现在我的问题是我没有正确地重定向到目的地。这是我的application-security-context.xml文件:-

<security:global-method-security secured-annotations="disabled"></security:global-method-security>
<security:http auto-config="false" entry-point-ref="casAuthenticationEntryPoint">
<security:intercept-url pattern="/js/**" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
<security:intercept-url pattern="/css/**" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
<security:intercept-url pattern="/img/**" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
<security:intercept-url pattern="/emailtemplate/**" access="IS_AUTHENTICATED_ANONYMOUSLY"/>

<security:intercept-url pattern="/index.jsp" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
<security:intercept-url pattern="/p/**" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
<security:intercept-url pattern="/dashboard" access="ROLE_USER, ROLE_ADMIN"/>
<security:intercept-url pattern="/admin/**" access="ROLE_ADMIN"/>
<security:intercept-url pattern="/user/**" access="ROLE_USER"/>

<security:intercept-url pattern="/**" access="ROLE_USER, ROLE_ADMIN"/>
<security:custom-filter after="CAS_FILTER" ref="casAuthenticationFilter"/>
<security:logout logout-success-url="/login"/>

</security:http>

<bean id="successHandler" class="com.testing.security.AuthenticationSuccessHandler">
<property name="defaultTargetUrl" value="/dashboard"/>
</bean>
<bean id="failureHandler" class="org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler">
<property name="defaultFailureUrl" value="/login"/>
</bean>

<security:authentication-manager alias="authenticationManager">
<security:authentication-provider ref="casAuthenticationProvider"/>
</security:authentication-manager>
<bean id="serviceProperties" class="org.springframework.security.cas.ServiceProperties">
<property name="service" value="https://localhost:8444/Testing/j_spring_cas_security_check"/>

  <property name="sendRenew" value="false"></property> 

</bean>

<bean id="casAuthenticationFilter" class="org.springframework.security.cas.web.CasAuthenticationFilter">
<property name="authenticationManager" ref="authenticationManager"/>
<property name="filterProcessesUrl" value="https://localhost:8444/Testing/j_spring_cas_security_check" />
    <property name="authenticationSuccessHandler">
       <bean class="org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler"
         p:alwaysUseDefaultTargetUrl="true"
         p:defaultTargetUrl="/dashboard"/>
<bean id="casAuthenticationEntryPoint" class="org.springframework.security.cas.web.CasAuthenticationEntryPoint">
<property name="loginUrl" value="https://localhost:8443/casserver3421/login"/>

<property name="serviceProperties" ref="serviceProperties"/>

<bean id="casAuthenticationEntryPoint" class="org.springframework.security.cas.web.CasAuthenticationEntryPoint">
<property name="loginUrl" value="https://localhost:8443/casserver3421/login"/>

<property name="serviceProperties" ref="serviceProperties"/>

<bean id="casAuthenticationEntryPoint" class="org.springframework.security.cas.web.CasAuthenticationEntryPoint">
<property name="loginUrl" value="https://localhost:8443/casserver3421/login"/>

<property name="serviceProperties" ref="serviceProperties"/>


请帮忙。提前感谢。

我看到了Spring CAS的文档,在示例中,CasAuthenticationFilter等于

<bean id="casAuthenticationEntryPoint" class="org.springframework.security.cas.web.CasAuthenticationEntryPoint">
<property name="loginUrl" value="https://localhost:8443/casserver3421/login"/>

<property name="serviceProperties" ref="serviceProperties"/>
  <bean id="casFilter"
    class="org.springframework.security.cas.web.CasAuthenticationFilter">
    <property name="authenticationManager" ref="authenticationManager"/>
  </bean>

也许您应该排除额外的配置,如SavedRequestAwareAuthenticationSuccessHandler

<bean id="casAuthenticationEntryPoint" class="org.springframework.security.cas.web.CasAuthenticationEntryPoint">
<property name="loginUrl" value="https://localhost:8443/casserver3421/login"/>

<property name="serviceProperties" ref="serviceProperties"/>

<bean id="casAuthenticationEntryPoint" class="org.springframework.security.cas.web.CasAuthenticationEntryPoint">
<property name="loginUrl" value="https://localhost:8443/casserver3421/login"/>

<property name="serviceProperties" ref="serviceProperties"/>