SAP BOE BusinessObjects Enterprise 单点登录,异构系统中打开BI报表

背景

公司开发了自己的WebBI,要求给一个BI报表的ID,即可打开SAP BI里的对应报表,不需要二次登录。

 

实现

1. BOE是基于令牌(Token)的认证方式
2. BOE提供直接打开报表的接口地址http://192.168.0.61:8080/OpenDocument/opendoc/openDocument.jsp

根据官方资料,openDocument.jsp页面需要必备的两个参数才能打开报表,一个是iDocID(报表的ID),一个是token(令牌)
目前的问题是只需要产生一个令牌即可实现外部系统打开报表的操作,并且能够实现BOE的单点登录

根据一些资料,单独制作了一个SSO.jsp页面,放在61的D:\BOE\Business Objects\Tomcat55\webapps\CmcApp下面,注意CmcApp是管理员的登录界面,不要放在用户的登录页面下(InfoViewApp)。

SSO.jsp介绍:
参数:uid用户名,pwd密码,rid报表ID
作用:获取参数,认证用户,产生令牌,传递到openDocument.jsp,打开报表

SSO.jsp代码:
<!DOCTYPE HTML PUBLIC
    "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
<%@ page language="java" contentType="text/html; charset=utf-8"%>

<%@ page import="com.crystaldecisions.sdk.framework.ISessionMgr" %>
<%@ page import="com.crystaldecisions.sdk.framework.CrystalEnterprise" %>
<%@ page import="com.crystaldecisions.sdk.framework.IEnterpriseSession" %>
<%@ page import="com.crystaldecisions.sdk.occa.security.ILogonTokenMgr"%>
<%@ page import="com.crystaldecisions.sdk.occa.infostore.*" %>
<%@ page import="com.crystaldecisions.sdk.properties.*" %>
<%@ page import="com.crystaldecisions.sdk.exception.SDKException" %>
<%@ page import="javax.servlet.jsp.JspWriter" %>
<%
try{
String cms = "boeprod01:6400";
String username = request.getParameter("uid");
String password = request.getParameter("pwd");
String reportID = request.getParameter("rid");
if(username==null||password==null||reportID==null){
out.println("参数错误,请检查");
return;
}

String auth = "secEnterprise";

String token="";
ISessionMgr sessionMgr = CrystalEnterprise.getSessionMgr();
IEnterpriseSession enterpriseSession = sessionMgr.logon(username, password, cms, auth);
ILogonTokenMgr logonTokenMgr = enterpriseSession.getLogonTokenMgr();
token = logonTokenMgr.getDefaultToken();
//String URLrequest = "http://192.168.0.61:8080/OpenDocument/opendoc/openDocument.jsp?token=" + token + "&iDocID="+reportID+"&lsSprodNameParam="+strParameter+"&sWindow=New";
String URLrequest = "http://192.168.0.61:8080/OpenDocument/opendoc/openDocument.jsp?sWindow=Same&isApplication=true&token=" + token + "&iDocID="+reportID;
response.sendRedirect(URLrequest);
}
catch(Exception error){
out.println("身份认证错误,请检查!");
}
%>

这样要打开一张报表只需要在浏览器地址中输入:
http://192.168.0.61:8080/CmcApp/SSO.jsp?uid=testadmin&pwd=*****&rid=6729
即可。

在地址栏中直接输入地址,支持所有浏览器。

但是,由于真实打开报表页面的地址为:viewDocument.jsp,页面中需要执行js代码,如果外部系统打开报表是通过iframe打开的话,IE浏览器会自动拦截,因为IE的权限设置,在iframe中不允许跨域执行内嵌页的js代码
Chrome,Firefox等浏览器没有这个限制,可以正常在iframe中打开

暂时的方案:将192.168.0.61加入到IE的可信任站点即可解决问题。
要想在iframe中打开,最可靠的方案是重写opendocument.jsp和viewDocument.jsp,绕开js。
另外简单的方法是把webbi和boe放在同一个域名下,因为ie禁止iframe跨域访问。

 

posted @ 2013-04-27 13:49  jackchain  阅读(1658)  评论(0编辑  收藏  举报