2016-08-04 192 views
0

在第一次請求期間,使用以下配置重定向到CAS服務器。但登錄後,它不會重定向到應用程序。這是正在發生的事情:CAS Spring客戶端 - 由於ERR_TOO_MANY_REDIRECTS而返回應用程序失敗

  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> 
    

回答

0

這時候我從下面的配置改變的模式解決了/ **到/ newviews/**這是針對我的UI文件。

<security:intercept-url pattern="/newviews/**" access="hasRole('ROLE_USER')" /> 
相關問題