2013-07-23 45 views
0

我想部署CAS服务器和客户端。 首先,是我在deployerConfigContext.xml里配置CAS服务器上:错误的路径CAS重定向

<bean class="org.jasig.cas.services.RegexRegisteredService"> 
    <property name="id" value="1" /> 
    <property name="name" value="HTTP and IMAP on localhost:8080/firstCasClient" /> 
    <property name="description" value="Allows HTTP(S) and IMAP(S) protocols on localhost:8080/firstCasClient" /> 
    <property name="serviceId" value="^(https?|imaps?)://([A-Za-z0-9_-]+\.)*localhost:8080/firstCasClient/*" /> 
    <property name="evaluationOrder" value="0" /> 
</bean> 

在我的客户,我使用的过滤器是这样的:

<!-- CAS --> 
    <filter> 
     <filter-name>CAS Authentication Filter</filter-name> 
     <filter-class>org.jasig.cas.client.authentication.AuthenticationFilter</filter-class> 
     <init-param> 
      <param-name>casServerLoginUrl</param-name> 
      <param-value>http://localhost:8888/cas-server-webapp-3.5.2/login</param-value> 
     </init-param> 
     <init-param> 
      <param-name>serverName</param-name> 
      <param-value>http://localhost:8080/firstCasClient</param-value> 
     </init-param> 
    </filter> 
    <filter> 
     <filter-name>CAS Validation Filter</filter-name> 
     <filter-class>org.jasig.cas.client.validation.Saml11TicketValidationFilter</filter-class> 
     <init-param> 
      <param-name>casServerUrlPrefix</param-name> 
      <param-value>http://localhost:8888/cas-server-webapp-3.5.2</param-value> 
     </init-param> 
     <init-param> 
      <param-name>serverName</param-name> 
      <param-value>http://localhost:8080/firstCasClient</param-value> 
     </init-param> 
    </filter> 
    <filter> 
     <filter-name>CAS HttpServletRequest Wrapper Filter</filter-name> 
     <filter-class>org.jasig.cas.client.util.HttpServletRequestWrapperFilter</filter-class> 
    </filter> 

<filter-mapping> 
     <filter-name>CAS Authentication Filter</filter-name> 
     <url-pattern>/*</url-pattern> 
    </filter-mapping> 
    <filter-mapping> 
     <filter-name>CAS Validation Filter</filter-name> 
     <url-pattern>/*</url-pattern> 
    </filter-mapping> 
    <filter-mapping> 
     <filter-name>CAS HttpServletRequest Wrapper Filter</filter-name> 
     <url-pattern>/*</url-pattern> 
    </filter-mapping> 

所以,当我去http://localhost:8080/firstCasClient/,它工作正常,我来到CAS认证页面。 但良好的身份验证后,CAS重定向我到这个网址:

http://localhost:8080/firstCasClient/firstCasClient/firstCasClient/ 

我不明白为什么,所以我来问你一些帮助。 我希望有人能帮助我:)

回答

0

我最终找到了解决方案。

我换成这行:

<init-param> 
    <param-name>serverName</param-name> 
    <param-value>http://localhost:8080/firstCasClient</param-value> 
</init-param> 

由:

<init-param> 
    <param-name>service</param-name> 
    <param-value>http://localhost:8080/firstCasClient</param-value> 
</init-param> 
在CAS Authentication Filter

CAS Validation Filter

然后,它工作得很好:)

0

你也可以更换

<init-param> 
     <param-name>serverName</param-name> 
     <param-value>http://localhost:8080/firstCasClient</param-value> 
    </init-param> 

<init-param> 
     <param-name>serverName</param-name> 
     <param-value>http://localhost:8080/</param-value> 
    </init-param> 

如果specifiy serverName你只需要提供服务器名而不是整个路径。