如何在SSO siteminder中的会话超时后检索上次请求的页面

时间:2015-03-02 11:55:07

标签: spring-mvc single-sign-on httpsession siteminder

应用程序是使用Spring MVC,JSP Servlets 2.4版开发的,并使用Siteminder的SSO进行身份验证。

问题: 会话超时后,文件下载功能无效。

预期行为 如果用户在会话时间结束后点击下载按钮,则应用程序应重定向到SSO登录页面并询问用户凭据,并在进行身份验证后显示下载对话框。

实际行为 如果用户在会话时间过后点击下载按钮,那么应用程序将停止运行,我将不得不编辑该网址以重新加载应用程序(从其主页或应从中进行下载的页面)。简单地重新加载页面不会打开“下载”对话框。

控制器:

 @RequestMapping(value ="/DownloadReport.spr", method = RequestMethod.GET)   

public String populateList( 
        HttpServletRequest request,
        ModelMap model)
{       
httpSession = request.getSession();

//get data to be populated into List is added to httpSession object.

return "viewName" ;
}


@SuppressWarnings("unchecked")
@RequestMapping(value="/ReportDownload.spr", method = {RequestMethod.GET } )
public void downlodReport(      
    HttpServletResponse response,   
    HttpServletRequest request,     
    @ModelAttribute (value="DataList") ArrayList<ClassObj> dataList,
    ModelMap model 
)
{
    FileTO fileTO = new FileTO ();
    httpSession = request.getSession();

    dataList = (ArrayList<ClassObj>) httpSession.getAttribute("ReportList")     ;



    if( dataList!= null ){


    if(dataList.isEmpty())
    {

        //show no data msg.
    }
    else{

     try
     {


        if( dataList.size() > 0 )
        {

            //call method to handle downloading data from java objects

            fileTO.excelFormat(request.getSession(), request, response,      dataList);
            model.addAttribute("dataList", dataList);
        }        

     }catch(Exception e) {

    //handle exception

    }
    } // end of else
    }
    else{

        System.out.println(" dataList is null , since session expired");
        // after session expires control reaches here

    }

}

1 个答案:

答案 0 :(得分:0)

SiteMinder会话到期后,任何请求都不会到达受保护的应用程序。所有请求(包括AJAX)都将导致在应用程序前运行的SiteMinder代理进行302重定向。

这里出现两种典型问题:

  • 经典Web应用程序将正确地重定向到SiteMinder SSO登录页面,但是在登录后可能会出现深层链接状态问题。 SiteMinder重定向到最初请求的同一页面。
  • AJAX应用程序对重定向产生的意外内容感到惊讶。 detect a redirect for AJAX没有直接的方式。