Browse Source

【增加】统一认证3.0:增加退出、获取状态接口;

和田中职
dyy 3 months ago
parent
commit
fa21226973
3 changed files with 198 additions and 2 deletions
  1. +97
    -1
      Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/SSOSystemController.cs
  2. +1
    -1
      Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/BaseApi.cs
  3. +100
    -0
      Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/SSOApi.cs

+ 97
- 1
Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/SSOSystemController.cs View File

@@ -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
/// <summary>
/// 退出
/// </summary>
/// <returns></returns>
[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");
}
/// <summary>
/// 获取用户登录状态
/// </summary>
/// <returns></returns>
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
/// <summary>
/// 获取统一认证用户信息
@@ -1362,7 +1458,7 @@ namespace Learun.Application.Web.Controllers
ViewBag.ReceiveFileListStr = JsonConvert.SerializeObject(ViewBag.ReceiveFileList);
//公告
List<NewsEntity> outnewslist = new List<NewsEntity>();
var newsList = newsIBLL.GetList("","");
var newsList = newsIBLL.GetList("", "");
foreach (var newsitemEntity in newsList)
{
if (!string.IsNullOrEmpty(newsitemEntity.F_SendPostId))


+ 1
- 1
Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/BaseApi.cs View File

@@ -180,7 +180,7 @@ namespace Learun.Application.WebApi
ReqParameter req = this.Bind<ReqParameter>();
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;
}


+ 100
- 0
Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/SSOApi.cs View File

@@ -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
/// <summary>
/// 退出
/// </summary>
/// <param name="_"></param>
/// <returns></returns>
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");
}
/// <summary>
/// 获取用户登录状态
/// </summary>
/// <param name="_"></param>
/// <returns></returns>
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

/// <summary>
/// 统一身份认证2.0
/// </summary>


Loading…
Cancel
Save