From fa21226973a941b04e147746fc4037cc1082b76b Mon Sep 17 00:00:00 2001 From: dyy <807692433@qq.com> Date: Tue, 20 Aug 2024 16:29:03 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=A2=9E=E5=8A=A0=E3=80=91=E7=BB=9F?= =?UTF-8?q?=E4=B8=80=E8=AE=A4=E8=AF=813.0=EF=BC=9A=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E9=80=80=E5=87=BA=E3=80=81=E8=8E=B7=E5=8F=96=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/SSOSystemController.cs | 98 ++++++++++++++++- .../Modules/BaseApi.cs | 2 +- .../Modules/SSOApi.cs | 100 ++++++++++++++++++ 3 files changed, 198 insertions(+), 2 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/SSOSystemController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/SSOSystemController.cs index 66ff479dd..1afd9f2ee 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/SSOSystemController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/SSOSystemController.cs @@ -59,6 +59,102 @@ namespace Learun.Application.Web.Controllers private MealCardRunTabIBLL mealCardRunTabIBLL = new MealCardRunTabBLL(); private Sys_UpdateRecordIBLL sys_UpdateRecordIBLL = new Sys_UpdateRecordBLL(); + #region 统一身份认证3.0 + /// + /// 退出 + /// + /// + [ActionName("out")] + public ActionResult outApplication() + { + string appid = Request.QueryString["appid"]; + string appkey = Request.QueryString["appkey"]; + string m = Request.QueryString["m"]; + string t = Request.QueryString["t"]; + if (string.IsNullOrEmpty(appid)) + { + return Fail("参数:appid不能为空"); + } + if (string.IsNullOrEmpty(appkey)) + { + return Fail("参数:appkey不能为空"); + } + if (string.IsNullOrEmpty(m)) + { + return Fail("参数:m不能为空"); + } + if (string.IsNullOrEmpty(t)) + { + return Fail("参数:t不能为空"); + } + var application = perm_FunctionIBLL.GetPerm_FunctionEntity(appid); + if (application != null) + { + if (Md5Helper.Encrypt(application.FSecret, 32) == appkey) + { + OperatorHelper.Instance.EmptyCurrent(DESEncrypt.Decrypt(t), DESEncrypt.Decrypt(m)); + return SuccessString("true"); + } + else + { + return Fail("appkey错误"); + } + } + else + return Fail("未授权的appid"); + } + /// + /// 获取用户登录状态 + /// + /// + public ActionResult userstat() + { + string appid = Request.QueryString["appid"]; + string appkey = Request.QueryString["appkey"]; + string m = Request.QueryString["m"]; + string t = Request.QueryString["t"]; + if (string.IsNullOrEmpty(appid)) + { + return Fail("参数:appid不能为空"); + } + if (string.IsNullOrEmpty(appkey)) + { + return Fail("参数:appkey不能为空"); + } + if (string.IsNullOrEmpty(m)) + { + return Fail("参数:m不能为空"); + } + if (string.IsNullOrEmpty(t)) + { + return Fail("参数:t不能为空"); + } + var application = perm_FunctionIBLL.GetPerm_FunctionEntity(appid); + if (application != null) + { + if (Md5Helper.Encrypt(application.FSecret, 32) == appkey) + { + OperatorResult res = OperatorHelper.Instance.IsOnLine(DESEncrypt.Decrypt(t), DESEncrypt.Decrypt(m)); + if (res.stateCode == 1) + { + return SuccessString("true"); + } + else + { + return Fail("登录无效"); + } + } + else + { + return Fail("appkey错误"); + } + } + else + return Fail("未授权的appid"); + } + + #endregion + #region 统一身份认证2.0 /// /// 获取统一认证用户信息 @@ -1362,7 +1458,7 @@ namespace Learun.Application.Web.Controllers ViewBag.ReceiveFileListStr = JsonConvert.SerializeObject(ViewBag.ReceiveFileList); //公告 List outnewslist = new List(); - var newsList = newsIBLL.GetList("",""); + var newsList = newsIBLL.GetList("", ""); foreach (var newsitemEntity in newsList) { if (!string.IsNullOrEmpty(newsitemEntity.F_SendPostId)) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/BaseApi.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/BaseApi.cs index 49ebfb025..b95e22449 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/BaseApi.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/BaseApi.cs @@ -180,7 +180,7 @@ namespace Learun.Application.WebApi ReqParameter req = this.Bind(); loginMark = req.loginMark; token = req.token; - if (path == "/learun/adms/user/login" || path == "/" || path == "/bgimg" || path == "/learun/adms/user/img" || path == "/learun/adms/desktop/img"||path== "/learun/adms/user/imgfordc"||path== "/learun/adms/annexes/down" || path == "/learun/adms/StampPersonal/img") + if (path == "/learun/adms/user/login" || path == "/" || path == "/bgimg" || path == "/learun/adms/user/img" || path == "/learun/adms/desktop/img"||path== "/learun/adms/user/imgfordc"||path== "/learun/adms/annexes/down" || path == "/learun/adms/StampPersonal/img" || path == "/quanjiang/sso/out" || path == "/quanjiang/sso/userstat") {// 登录接口,默认页面接口不做权限验证处理 return null; } diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/SSOApi.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/SSOApi.cs index 8a4195f1c..aa17a28f7 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/SSOApi.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/SSOApi.cs @@ -13,6 +13,7 @@ using Learun.Application.TwoDevelopment.Permission; using System; using Learun.Cache.Factory; using Learun.Cache.Base; +using Learun.Util.Operat; namespace Learun.Application.WebApi.Modules { @@ -35,8 +36,107 @@ namespace Learun.Application.WebApi.Modules Get["first"] = First; Post["first"] = FirstPost; Get["authorize"] = Authorize; + Get["/out"] = outApplication; + Get["/userstat"] = userstat; } + #region 统一身份认证3.0 + /// + /// 退出 + /// + /// + /// + public Response outApplication(dynamic _) + { + string appid = Request.Query["appid"]; + string appkey = Request.Query["appkey"]; + string m = Request.Query["m"]; + string t = Request.Query["t"]; + if (string.IsNullOrEmpty(appid)) + { + return Fail("参数:appid不能为空"); + } + if (string.IsNullOrEmpty(appkey)) + { + return Fail("参数:appkey不能为空"); + } + if (string.IsNullOrEmpty(m)) + { + return Fail("参数:m不能为空"); + } + if (string.IsNullOrEmpty(t)) + { + return Fail("参数:t不能为空"); + } + var application = perm_FunctionIBLL.GetPerm_FunctionEntity(appid); + if (application != null) + { + if (Md5Helper.Encrypt(application.FSecret, 32) == appkey) + { + OperatorHelper.Instance.EmptyCurrent(DESEncrypt.Decrypt(t), DESEncrypt.Decrypt(m)); + return SuccessString("true"); + } + else + { + return Fail("appkey错误"); + } + } + else + return Fail("未授权的appid"); + } + /// + /// 获取用户登录状态 + /// + /// + /// + public Response userstat(dynamic _) + { + string appid = Request.Query["appid"]; + string appkey = Request.Query["appkey"]; + string m = Request.Query["m"]; + string t = Request.Query["t"]; + if (string.IsNullOrEmpty(appid)) + { + return Fail("参数:appid不能为空"); + } + if (string.IsNullOrEmpty(appkey)) + { + return Fail("参数:appkey不能为空"); + } + if (string.IsNullOrEmpty(m)) + { + return Fail("参数:m不能为空"); + } + if (string.IsNullOrEmpty(t)) + { + return Fail("参数:t不能为空"); + } + var application = perm_FunctionIBLL.GetPerm_FunctionEntity(appid); + if (application != null) + { + if (Md5Helper.Encrypt(application.FSecret, 32) == appkey) + { + OperatorResult res = OperatorHelper.Instance.IsOnLine(DESEncrypt.Decrypt(t), DESEncrypt.Decrypt(m)); + if (res.stateCode == 1) + { + return SuccessString("true"); + } + else + { + return Fail("登录无效"); + } + } + else + { + return Fail("appkey错误"); + } + } + else + return Fail("未授权的appid"); + } + + #endregion + /// /// 统一身份认证2.0 ///