CAS Spring客户端 - 由于ERR_TOO_MANY_REDIRECTS而重定向回应用程序失败

时间:2016-08-04 22:21:16

标签: java spring cas

在第一次请求期间使用以下配置,将其重定向到CAS服务器。但登录后,它不会重定向回应用程序。这就是发生的事情:

  1. 打开https://localhost:8443/test
  2. 重定向到https://localhost:9443/cas/login?service=https%3A%2F%2Flocalhost%3A8443%2Ftest%2F
  3. 输入正确的凭据后,它不会重定向回应用程序。浏览器上的URL是相同的CAS登录URL,由于ERR_TOO_MANY_REDIRECTS,页面被破坏。

    <security:http entry-point-ref="casEntryPoint">
        <security:intercept-url pattern="/**" access="hasRole('ROLE_USER')" />
        <security:custom-filter position="CAS_FILTER"
            ref="casFilter" />
    </security:http>
    
    <bean id="casEntryPoint"
        class="org.springframework.security.cas.web.CasAuthenticationEntryPoint">
        <property name="loginUrl" value="https://localhost:9443/cas/login/" />
        <property name="serviceProperties" ref="serviceProperties" />
    </bean>
    
    <bean id="casFilter"
        class="org.springframework.security.cas.web.CasAuthenticationFilter">
        <property name="authenticationManager" ref="authenticationManager" />
    </bean>
    
    <security:authentication-manager alias="authenticationManager">
        <security:authentication-provider
            ref="casAuthenticationProvider" />
    </security:authentication-manager>
    
    <bean id="casAuthenticationProvider"
        class="org.springframework.security.cas.authentication.CasAuthenticationProvider">
        <property name="authenticationUserDetailsService">
            <bean
                class="org.springframework.security.core.userdetails.UserDetailsByNameServiceWrapper">
                <constructor-arg ref="userService" />
            </bean>
        </property>
        <property name="serviceProperties" ref="serviceProperties" />
        <property name="ticketValidator">
            <bean class="org.jasig.cas.client.validation.Cas20ServiceTicketValidator">
                <constructor-arg index="0" value="https://localhost:9443/cas/" />
            </bean>
        </property>
        <property name="key" value="an_id_for_this_auth_provider_only" />
    </bean>
    
    <security:user-service id="userService">
        <security:user name="admin" password="admin" authorities="ROLE_USER" />
    </security:user-service>
    
    <bean id="serviceProperties" class="org.springframework.security.cas.ServiceProperties">
        <property name="service" value="https://localhost:8443/test/" />
        <property name="sendRenew" value="false" />
    </bean>
    

1 个答案:

答案 0 :(得分:0)

当我将以下配置的模式从/ **更改为/ newviews / **时,这已解决,这是特定于我的UI文件。

e2