📄 hetongandliucheng.java
字号:
package com.mdcl.mocha.jlcmcc.sso;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.mdcl.mocha.bpm.portal.common.conf.CommonConfigurationManager;
import com.mdcl.mocha.bpm.portal.common.exception.LoginFailedException;
import com.mdcl.mocha.bpm.portal.common.exception.LoginInvalidateException;
import com.mdcl.mocha.bpm.portal.common.security.SSOTokenManager;
import com.mdcl.mocha.bpm.portal.container.util.URLUtil;
import com.mdcl.mocha.bpm.sdk.license.ExpiryException;
import com.mdcl.mocha.bpm.sdk.license.LicenseException;
import com.mdcl.mocha.bpm.sdk.license.NotFoundModuleException;
/**
* @author mdcl
*
* TODO To change the template for this generated type comment go to Window -
* Preferences - Java - Code Style - Code Templates
*/
public class HetongAndLiucheng {
/**
* 获取Cookies 列表,获得 iPlanetDirectoryPro 的值.并将其写入cookie以获取BPM的登陆验证
* 最终如果通过验证则将页面发送到portal请求的页面,失败则由BPM自动转到需要验证的登录页面
* public static final String LOGED_ON_USER = "zhibiao_user";
* @throws LicenseException
* @throws ExpiryException
* @throws NotFoundModuleException
* @throws LoginInvalidateException
* @throws LoginFailedException
* @return SSO验证成功之后转发的页面
*/
public static String getSSOOfPage(HttpServletRequest httpServletRequest,HttpServletResponse httpServletResponse,String urlKey) throws NotFoundModuleException, ExpiryException, LicenseException, LoginFailedException, LoginInvalidateException {
loginid = CheckPermission.getUserid(httpServletRequest);
if (loginid != null || !"".equals(loginid)) {
//此处为BPM授权
//获取实例化SSOTokenManager需要的key和cooktimeout
CommonConfigurationManager commonConfigurationManager = CommonConfigurationManager.getInstance();
String key = commonConfigurationManager.getSecurityTokenKey();//key
int cooktimeout = commonConfigurationManager.getCookieTimeout();
SSOTokenManager tokenManager = new SSOTokenManager(key,cooktimeout);
//将cookie写入到BPM的信用认证
Cookie cookie = tokenManager.createSSOTokenCookie(loginid);
if (cookie != null) {
httpServletResponse.addCookie(cookie);
}
}
String url = URLUtil.generateActionURL(httpServletRequest, true ,urlKey);
return url;
}
private static String loginid = null;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -