JSF Siteminder注销

时间:2011-10-29 04:48:34

标签: jsf richfaces jsf-1.2 siteminder

环境

  • Richfaces 3.3.3
  • JSF 1.2
  • SiteMinder的

要求

用户输入所需的申请地址。 Siteminder拦截并要求输入用户名和密码。客户提供凭证。客户端使用应用程序并单击注销/退出按钮。应用程序销毁会话并将302重定向到相同的应用程序地址,Siteminder应再次拦截。

问题

我正在尝试从siteminder登录的richfaces应用程序注销。注销后,转到siteminder的登录页面,返回应用程序的主页面。似乎它正在杀死应用程序会话而不是siteminder会话。有没有办法注销siteminder?

代码

public String logout() {
    ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
    HttpSession session = (HttpSession)ec.getSession(false);

    if (session != null) {
        session.invalidate();
    }

    try {
        String redirectPath = "https://abcd.xyz.com/context/start.jsf";
        ec.redirect(redirectPath);
    } catch (IOException e) {
        e.printStackTrace();
    }

return null;

日志

com.ibm.ws.webcontainer.servlet.ServletWrapper doDestroy SRVE0253I [hostname] [/ context] [uri]:销毁成功。 com.ibm.ws.webcontainer.servlet.ServletWrapper init SRVE0242I [hostname] [/ context] [uri]:初始化成功。

2 个答案:

答案 0 :(得分:2)

如果标头中的SM_USER值为null / empty,则使用servletfilter中的以下代码强制执行重定向。

if(servletPath.trim().equals("/login/logout.do")){
                    log.debug("User Logged Out. Redirecting to " + contextPath + homeLink);
                    RequestDispatcher rd = request.getRequestDispatcher(homeLink);
                    rd.forward(request, response);
                    return;                 
                } 

答案 1 :(得分:0)

您需要更新托管应用程序的Web代理的代理配置对象(ACO)。 LogOffUri参数指示SiteMinder Web代理销毁SMSESSION(实际上将值设置为LOGGEDOFF)。

如果您配置LogOffUri ACO参数中指定的URI以将用户重定向回应用程序的主URL,WebAgent将检测到SMSESSION无效并将用户发送到登录页面。