我正在尝试部署CAS服务器和客户端。 首先,在CAS服务器上的deployerConfigContext.xml中有我的配置:
<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 :(得分:0)
我终于找到了解决方案。
我替换了这句话:
<init-param>
<param-name>serverName</param-name>
<param-value>http://localhost:8080/firstCasClient</param-value>
</init-param>
by:
<init-param>
<param-name>service</param-name>
<param-value>http://localhost:8080/firstCasClient</param-value>
</init-param>
CAS中的 Authentication Filter
和CAS Validation Filter
然后它可以正常工作:)
答案 1 :(得分: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>
如果指定serverName
,则只需提供服务器名称而不是整个路径。