星空第三方单点登录开发方案
1.管理员登陆配置第三方系统登陆授权
拿到应用ID,应用密匙用于获取金蝶单点登陆url
2.具体实现过程
以泛微为例,泛微点击单点登录的按钮,会向配置好的url发送请求,同时会在url加上当前用户信息,拿到这个用户信息以及第一步金蝶配置好的应用ID,应用密匙就可以生成金蝶单点登陆的url,生成url后调用Response.Redirect(url)方式实现跳转到金蝶界面。
泛微单点登录按钮
绑定的url:
http://ip/k3cloud/SSTO.K3Cloud.SYS.sync.Plugin.Service.GetLogUrl.ExecuteService,SSTO.K3Cloud.SYS.sync.Plugin.common.kdsvc
设置参数:
参数名:code
参数值:用户账号
3.金蝶自定义API代码
using Kingdee.BOS.ServiceFacade.KDServiceFx; using Kingdee.BOS.Util; using Kingdee.BOS.WebApi.ServicesStub; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.ComponentModel; using System.IO; using System.Linq; using System.Net; using System.Text; using System.Text.RegularExpressions; using System.Web; namespace SSTO.K3Cloud.SYS.sync.Plugin.Service { [Kingdee.BOS.Util.HotUpdate] [Description("泛微单点登陆金蝶云星空")] public class GetLogUrl : AbstractWebApiBusinessService { //环境 private static string dbId = "62957457ae3016";//数据中心ID private static string appId = "228503_230u2xjtRrgX3fxIT+TPU91FTq17wqMF";//应用ID private static string appSecret = "eca04825f04d45b79ed6d48191aa511c";//应用密钥 private static string url = "http://127.0.0.1/k3cloud";//金蝶外网地址 public GetLogUrl(KDServiceContext context) : base(context) { } public JObject ExecuteService(JObject parameter) { Kingdee.BOS.Log.Logger.Info("泛微登陆START", this.KDContext.WebContext.Context.Request.Url.ToString()); JObject messages = new JObject(); string userName = this.KDContext.WebContext.Context.Request["code"]; if(userName != null && !userName.Equals("")) { int lcId = 2052; long timestamp = DateTimeFormatUtils.CurrentTimeMillis() / 1000;//时间戳 string[] arr = new string[] { dbId, userName, appId, appSecret, timestamp.ToString() }; string sign = Kingdee.BOS.Util.SHA1Util.GetSignature(arr);//签名 JObject argJosn = new JObject(); argJosn.Add("dbid", dbId); argJosn.Add("username", userName); argJosn.Add("appid", appId); argJosn.Add("signeddata", sign); argJosn.Add("timestamp", timestamp); argJosn.Add("lcid", lcId); argJosn.Add("origintype", "SimPas"); argJosn.Add("entryrole", ""); argJosn.Add("formid", ""); argJosn.Add("formtype", ""); argJosn.Add("pkid", ""); argJosn.Add("otherargs", ""); string para = Regex.Replace(argJosn.ToString(), @"\s", ""); string argJsonBase64 = System.Text.UTF8Encoding.Default.GetBytes(para).ToBase64();//base64编码 // string silverlightUrl = url + "Silverlight/Index.aspx?ud=" + argJsonBase64;// Silverlight入口 string html = url + "/html5/Index.aspx?ud=" + argJsonBase64;// Html5入口 this.KDContext.WebContext.Context.Response.Redirect(html); messages.Add("issuccess", "true"); // messages.Add("SilverlightUrl", silverlightUrl); messages.Add("HtmlUrl", html); } Kingdee.BOS.Log.Logger.Info("泛微登陆END", this.KDContext.WebContext.Context.Request.Url.ToString()); return messages; } } }
4.相关文档
WebApi,自定义接口详解:
https://wenku.my7c.com/article/218296473741031424?productLineId=1
自定义API接口Java怎么调用:
https://wenku.my7c.com/questions/324933297346151424/answers/324938023991522816?productLineId=1
第三方系统单点登录到金蝶云指南V3:
https://wenku.my7c.com/article/230984230253892096?productLineId=1
你好,我根据"https://vip.kingdee.com/article/37406"生成的签名总是无法使用,有碰到过这种情况吗?
星空第三方单点登录开发方案
1.管理员登陆配置第三方系统登陆授权拿到应用ID,应用密匙用于获取金蝶单点登陆url2.具体实现过程以泛微为例,泛微点击单点登录的按钮,会...
点击下载文档
本文2024-09-16 17:17:30发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-14760.html
您需要登录后才可以发表评论, 登录登录 或者 注册
最新文档
热门文章