金蝶EAS通过第三方系统单点登录
操作步骤
1、需要有LtpaTokenManager.jar包
2、从EAS服务器上下载 server\profiles\server(1…n)\config\portalConfig\LtpaToken.properties
3、将服务端server\profiles\server(1…n)\config\portalConfig目录下的ssoClient.properties文件中的sso.easIsSSOClient参数项的值修改为true;
4、将服务端server\profiles\server(1…n)\config\portalConfig目录下的autoLoginConfig.properties文件中的datacenter参数修改为EAS portal要登录的数据中心代码 (即:数据中心id),将authPattern参数修改为BaseTrdLtpaToken,并设置数据库类型(如:dbType=0),其中0代表sql server,1代表db2,2代表oracle。
5、重新启动EAS 服务器;
第三方系统代码示例
示例jsp代码如下:
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="com.kingdee.eas.cp.eip.sso.ltpa.LtpaTokenManager,com.kingdee.eas.cp.eip.sso.ltpa.LtpaToken"%>
<%@ page import = "java.net.URLEncoder" %>
<% String username = "user"; String password = LtpaTokenManager.generate(username, LtpaTokenManager.getDefaultLtpaConfig()).toString();
//新门户则需要将/easportal替换成/portal,其他一样。
String url = "http://192.168.33.243:6888/easportal/index2sso.jsp?username="+username+"&password="+password; %>
<a href=<%=url%> target="_blank">EAS Portal</a>
示例java代码如下:
public static String login_easportal() {
从EAS服务器上下载 server\profiles\server(1...n)\config\portalConfig\LtpaToken.properties
File file2 = new File("D:\\jt_oa\\workspace_TH1\\WebServiceProject\\LtpaToken.properties");
String configPath = String.valueOf(file2.getAbsolutePath());
//用户
String username = "king";
//要跳转的url
String redirectTo = "//"; "//"表示首页
//String redirectTo = "http://192.168.0.12:8080/portal/index.jsp";
//调用LtpaTokenManager,根据密钥生成用户令牌
String password = LtpaTokenManager.generate(username, configPath).toString();
System.out.println("password1="+password);
//生成EAS单点登录地址
String url = "http://192.168.0.12:6890/portal/index2sso.jsp?username="+username+"&password="+password+"&redirectTo="+redirectTo+"&isNotCheckRelogin=true";
//验证Token
LtpaTokenManager.isValid(password);
return url;
}