|
楼主 |
发表于 2018-2-10 01:47:55
|
显示全部楼层
实现单点登录,关键在于用下面的函数直接将账号登录到Biz服务器(不需要密码),并返回bsessionid:
private String ntLogin(String username){
String language = "zh_CN";
Action action = new Action();
action.setProcess("/SA/OPM/system/systemProcess");
action.setActivity("mainActivity");
action.setName("ntLoginAction");
action.setParameter("name", username);
action.setParameter("loginDate", new java.sql.Date(System.currentTimeMillis()));
action.setParameter("ip", "127.0.0.1");
action.setParameter("options", new HashMap<String, Object>());
action.setParameter("lang", language);
try {
ActionResult ar = ActionEngine.invokeActions(JustepConfig.getBusinessServer() + "/login2", null, action.asXML().getBytes("UTF-8"),
null, ActionUtils.XML_CONTENT_TYPE, ActionUtils.XML_CONTENT_TYPE,
null, language, "post", null);
if (ar.isSuccess()){
return ar.getBSessionID();
}else{
throw new RuntimeException(ar.getMessage());
}
} catch (Exception e) {
logger.error(e.getMessage()+"", e);
throw new RuntimeException(e.getMessage()+"", e);
}
}
如果是在多租户模式下,也能采用这种方式将账号直接登录到Biz服务器吗?如果能的话,client_id=xxxx参数要放在哪个地方呢? |
|