CAS验证成功后不能跳转到登陆成功的主页面
现在部署了CAS,有一个应用,下载输入应用的URL可以正确跳转到CAS服务的登陆界面,登陆验证通过后页面却跳转到了应用的登陆界面,不能直接进入登陆成功的主页面!应用的web.xml如下
<!-- 用于单点登录 -->
<filter>
<filter-name>CASFilter</filter-name>
<filter-class>org.jasig.cas.client.authentication.AuthenticationFilter</filter-class>
<init-param>
<param-name>casServerLoginUrl</param-name>
<param-value>https://TP_1010000110011000:8443/cas/login</param-value>
</init-param>
<init-param>
<param-name>serverName</param-name>
<param-value>http://localhost:8080</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>CASFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- 该过滤器负责Ticket的校验工作 -->
<filter>
<filter-name>CAS Validation Filter</filter-name>
<filter-class>
org.jasig.cas.client.validation.Cas20ProxyReceivingTicketValidationFilter</filter-class>
<init-param>
<param-name>casServerUrlPrefix</param-name>
<param-value>https://TP_1010000110011000:8443/cas</param-value>
</init-param>
<init-param>
<param-name>serverName</param-name>
<param-value>http://localhost:8080</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>CAS Validation Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- 该过滤器负责实现HttpServletRequest请求的包裹 -->
<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 HttpServletRequest Wrapper Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!--自定义cas设置user过滤器-->
<filter>
<display-name>AutoSetUserAdapterFilter</display-name>
<filter-name>AutoSetUserAdapterFilter</filter-name>
<filter-class>com.cdt.cas.client.casClientFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>AutoSetUserAdapterFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
casClientFilter的代码如下:
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse,
FilterChain chain) throws IOException, ServletException {
Date startTime = new Date();
System.out.println("CasClient开始时间"+startTime.getTime());
final HttpServletRequest request = (HttpServletRequest) servletRequest;
final HttpServletResponse response = (HttpServletResponse) servletResponse;
final HttpSession session = request.getSession(false);
final Assertion assertion = (Assertion) (session == null ? request
.getAttribute(AbstractCasFilter.CONST_CAS_ASSERTION) : session
.getAttribute(AbstractCasFilter.CONST_CAS_ASSERTION));
String username = assertion == null ? null : assertion.getPrincipal().getName();
//_const_cas_assertion_是CAS中存放登录用户名的session标志
Object object = request.getSession().getAttribute("_const_cas_assertion_");
String url = request.getRequestURL().toString();
if(object != null && username != null) {
//存放用户类型
session.setAttribute("userType", "2");
//设置cookie
Cookie cookie = new Cookie("username",username);
int maxAge = 60*60*24*365; //cookie存活时间1年
cookie.setMaxAge(maxAge);
response.addCookie(cookie);
}
if (chain != null) {
chain.doFilter(request, response);
}
Date endTime = new Date();
System.out.println("CasClient结束时间"+endTime.getTime());
}
请教各位高手!这个到底怎么弄啊!现在一直跳转到登陆页面!没有进入到登陆成功的页面啊! CAS web.xml url --------------------编程问答-------------------- 还有~FF浏览器是跳转到应用的登陆页面!IE是直接出来个 “无法显示此页” --------------------编程问答-------------------- 是不是跳转的url不正确 或者新页面所在的项目没启动 --------------------编程问答-------------------- Ls的问题已经解决!现在都可以正常登陆了
但是为什么我现在部署了两个应用A和B
服务器是这样的CAS服务器和应用A是同一个tomcat,B是不同的服务器
现在输入A的地址能够跳转到CAS登陆页面正常登陆了~但是同一窗口在此输入B地址却又跳转到CAS登陆页面需要重新登陆!这是什么原因啊!求解答!!!!!
补充:Java , Java EE