Parcourir la source

更新统一认证到2.0最新

北屯中职分支
liangkun il y a 1 an
Parent
révision
e8705e388f
7 fichiers modifiés avec 135 ajouts et 14 suppressions
  1. +0
    -6
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Permission/Controllers/Perm_FunctionVisitController.cs
  2. +5
    -1
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Permission/Views/Perm_Function/Form.cshtml
  3. +1
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Permission/Views/Perm_Function/Form.js
  4. +1
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Permission/Views/Perm_Function/TeacherIndex.js
  5. +8
    -0
      Learun.Framework.Ultimate V7/Learun.Application.WebApi/Learun.Application.WebApi.csproj
  6. +115
    -7
      Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/SSOApi.cs
  7. +5
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Permission/Perm_Function/Perm_FunctionEntity.cs

+ 0
- 6
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Permission/Controllers/Perm_FunctionVisitController.cs Voir le fichier

@@ -28,12 +28,6 @@ namespace Learun.Application.Web.Areas.Permission.Controllers
{
return View();
}

[HttpGet]
public ActionResult IndexForCount()
{
return View();
}
/// <summary>
/// 表单页
/// <summary>


+ 5
- 1
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Permission/Views/Perm_Function/Form.cshtml Voir le fichier

@@ -35,10 +35,14 @@
<div class="lr-form-item-title">是否启用<font face="宋体">*</font></div>
<div id="FEnabled" isvalid="yes" checkexpession="NotNull"></div>
</div>
<div class="col-xs-12 lr-form-item" data-table="Perm_Function">
<div class="col-xs-6 lr-form-item" data-table="Perm_Function">
<div class="lr-form-item-title">是否管理页<font face="宋体">*</font></div>
<div id="FIsManagePage" isvalid="yes" checkexpession="NotNull"></div>
</div>
<div class="col-xs-6 lr-form-item" data-table="Perm_Function">
<div class="lr-form-item-title">是否手机端<font face="宋体">*</font></div>
<div id="FIsH5" isvalid="yes" checkexpession="NotNull"></div>
</div>
<div class="col-xs-12 lr-form-item" data-table="Perm_Function">
<div class="lr-form-item-title">图片<font face="宋体">*</font></div>
<div id="FImage" isvalid="yes" checkexpession="NotNull" ></div>


+ 1
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Permission/Views/Perm_Function/Form.js Voir le fichier

@@ -30,6 +30,7 @@ var bootstrap = function ($, learun) {
}
$('#FEnabled').lrDataItemSelect({ code: 'YesOrNoBit' });
$('#FIsManagePage').lrDataItemSelect({ code: 'YesOrNoBit' });
$('#FIsH5').lrDataItemSelect({ code: 'YesOrNoBit' });
$('#FImage').lrUploader();
},
initData: function () {


+ 1
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/Permission/Views/Perm_Function/TeacherIndex.js Voir le fichier

@@ -97,6 +97,7 @@ var bootstrap = function ($, learun) {
param = param || {};
param.FTId = FTId;
param.UserId = UserId;
param.FIsH5 = 0;
$('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) });
}
};


+ 8
- 0
Learun.Framework.Ultimate V7/Learun.Application.WebApi/Learun.Application.WebApi.csproj Voir le fichier

@@ -327,6 +327,14 @@
<Project>{88d8e99d-df26-4506-83c5-51e354818bef}</Project>
<Name>Learun.Application.WorkFlow</Name>
</ProjectReference>
<ProjectReference Include="..\Learun.Framework.Module\Learun.Cache\Learun.Cache.Base\Learun.Cache.Base.csproj">
<Project>{975f2cb8-605c-4add-b365-b97bf844f0fe}</Project>
<Name>Learun.Cache.Base</Name>
</ProjectReference>
<ProjectReference Include="..\Learun.Framework.Module\Learun.Cache\Learun.Cache.Factory\Learun.Cache.Factory.csproj">
<Project>{68902fcf-c439-4010-b17b-2499c972ee33}</Project>
<Name>Learun.Cache.Factory</Name>
</ProjectReference>
<ProjectReference Include="..\Learun.Framework.Module\Learun.Db\Learun.DataBase.EF.Oracle\Learun.DataBase.Oracle.csproj">
<Project>{82069f3a-ab45-4f8b-b2bf-a36b14208f41}</Project>
<Name>Learun.DataBase.Oracle</Name>


+ 115
- 7
Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/SSOApi.cs Voir le fichier

@@ -11,6 +11,8 @@ using Learun.Application.OA;
using System.Configuration;
using Learun.Application.TwoDevelopment.Permission;
using System;
using Learun.Cache.Base;
using Learun.Cache.Factory;

namespace Learun.Application.WebApi.Modules
{
@@ -21,14 +23,73 @@ namespace Learun.Application.WebApi.Modules
private Perm_FunctionTypeIBLL perm_FunctionTypeIBLL = new Perm_FunctionTypeBLL();
Perm_UserPermissionIBLL permUserPermissionIbll = new Perm_UserPermissionBLL();
private Perm_FunctionVisitIBLL functionVisitIbll = new Perm_FunctionVisitBLL();
private ICache cache = CacheFactory.CaChe();

public SSOApi()
: base("/quanjiang/sso")
{
Get["/list"] = GetList;
Get["/list20"] = GetList20;
Get["/goto"] = GoTo;
Get["/goto20"] = GoToApplication;
Get["first"] = First;
Post["first"] = FirstPost;
Get["authorize"] = Authorize;
}

/// <summary>
/// 统一身份认证2.0
/// </summary>
/// <param name="_"></param>
/// <returns></returns>
public Response Authorize(dynamic _)
{
string appid = Request.Query["appid"];
string secret = Request.Query["secret"];
string appkey = Request.Query["appkey"];
if (string.IsNullOrEmpty(appid))
{
return Fail("参数:appid不能为空");
}
if (string.IsNullOrEmpty(secret))
{
return Fail("参数:secret不能为空");
}
if (string.IsNullOrEmpty(appkey))
{
return Fail("参数:appkey不能为空");
}
var application = perm_FunctionIBLL.GetPerm_FunctionEntity(appid);
if (application != null)
{
if (Util.DESEncrypt.Decrypt(application.FSecret,
ConfigurationManager.AppSettings["SSOPublicSecret"]).Equals(secret))
{
try
{
var code = DESEncrypt.Decrypt(appkey, "bjqjsso");

if (!string.IsNullOrEmpty(cache.Read<string>(code)))
{
return Success(new { useraccount = cache.Read<string>(code) });
}
else
{
return Fail("appkey已过期");
}
}
catch (Exception e)
{
return Fail("appkey错误");
}
}
else
{
return Fail("secret错误");
}
}
else
return Fail("未授权的appid");
}

private Response FirstPost(dynamic _)
@@ -43,7 +104,7 @@ namespace Learun.Application.WebApi.Modules
up.FId = ssoparam.FId;
up.UserId = ssoparam.UserId;
perm_FunctionIBLL.SaveEntityByUPId(ssoparam.UPId, up);
return Success(new{ FInterfaceUrl="/SSO/GoTo?sysid=" + DESEncrypt.Encrypt(up.FId, publickey) + "&openid=" + DESEncrypt.Encrypt(up.UserId, publickey)});
return Success(new { FInterfaceUrl = "/SSO/GoTo?sysid=" + DESEncrypt.Encrypt(up.FId, publickey) + "&openid=" + DESEncrypt.Encrypt(up.UserId, publickey) });
}
else
{
@@ -77,6 +138,39 @@ namespace Learun.Application.WebApi.Modules
public string UserId { get; set; }
public string UPUserName { get; set; }
public string UPPass { get; set; }
public string appid { get; set; }
}

public Response GoToApplication(dynamic _)
{
var userinfo = userInfo;
var ssoparam = this.GetReqData<SSOParam>();
if (userinfo != null)
{
var perm_application = perm_FunctionIBLL.GetPerm_FunctionEntity(ssoparam.appid);
if (perm_application != null)
{
//写入当前请求所登录的用户
var code = Util.CommonHelper.RndNum(9);
cache.Write(code, userinfo.account, TimeSpan.FromMinutes(10));
var url = perm_application.FInterfaceUrl;
if (url.Contains("?"))
{
url += "&appkey=" + DESEncrypt.Encrypt(code, "bjqjsso");
}
else
{
url += "?appkey=" + DESEncrypt.Encrypt(code, "bjqjsso");
}
return Success(new{ FInterfaceUrl=url });
}
else
return Fail("appid解析失败,请确认。");
}
else
{
return Fail("用户信息解析失败,请确认。");
}
}

public Response GoTo(dynamic _)
@@ -116,8 +210,9 @@ namespace Learun.Application.WebApi.Modules
functionVisitEntity.PIsLoginSuccess = true;
functionVisitEntity.PContent = "成功转到统一认证网站:" + perfun.FUrl;
functionVisitIbll.SaveEntity(null, functionVisitEntity);
return Success(new {
FInterfaceUrl=perfun.FInterfaceUrl + "?u=" +
return Success(new
{
FInterfaceUrl = perfun.FInterfaceUrl + "?u=" +
DESEncrypt.Encrypt(DESEncrypt.Encrypt(perfun.UPUserName, secretkey),
publickey) + "&p=" +
DESEncrypt.Encrypt(DESEncrypt.Encrypt(perfun.UPPass, secretkey),
@@ -125,7 +220,8 @@ namespace Learun.Application.WebApi.Modules
DESEncrypt.Encrypt(
DESEncrypt.Encrypt(DateTime.Now.ToString("yyyyMMddHHmmss"), secretkey),
publickey) + "&ip=" +
DESEncrypt.Encrypt(DESEncrypt.Encrypt(GetIP(), secretkey), publickey)});
DESEncrypt.Encrypt(DESEncrypt.Encrypt(GetIP(), secretkey), publickey)
});
}
else
{
@@ -133,7 +229,7 @@ namespace Learun.Application.WebApi.Modules
functionVisitEntity.PContent = "用户未配置转到用户名密码配置页面";
functionVisitIbll.SaveEntity(null, functionVisitEntity);
//用户未配置转到用户名密码配置页面
return Success(new{ FInterfaceUrl = "/SSO/FirstLogin?sysid=" + sysid + "&openid=" + openid});
return Success(new { FInterfaceUrl = "/SSO/FirstLogin?sysid=" + sysid + "&openid=" + openid });
}
}
else
@@ -151,7 +247,7 @@ namespace Learun.Application.WebApi.Modules
functionVisitEntity.PIsLoginSuccess = true;
functionVisitEntity.PContent = "成功转到统一认证网站:" + perfun.FUrl;
functionVisitIbll.SaveEntity(null, functionVisitEntity);
return Success(new { FInterfaceUrl=perfun.FUrl});
return Success(new { FInterfaceUrl = perfun.FUrl });
}
else
{
@@ -168,6 +264,18 @@ namespace Learun.Application.WebApi.Modules
}
}

public Response GetList20(dynamic _)
{
var userinfo = userInfo;
var functionlist = perm_FunctionIBLL.GetListByUserId(userinfo.userId).Where(m=>m.FIsH5==true).Select(m=>
new
{
m.FName,
m.FId,
});
return Success(functionlist);
}


/// <summary>
/// 获取页面显示列表数据
@@ -181,7 +289,7 @@ namespace Learun.Application.WebApi.Modules
var datatype = perm_FunctionTypeIBLL.GetListByUserId(userInfo.userId);
foreach (var typeEntity in datatype)
{
var datafunction = perm_FunctionIBLL.GetListByFTId(typeEntity.FTId, userInfo.userId);
var datafunction = perm_FunctionIBLL.GetListByFTId(typeEntity.FTId, userInfo.userId).Where(m=>m.FIsH5==true);
foreach (var item in datafunction)
{
if (item.FIsManagePage == true)


+ 5
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Permission/Perm_Function/Perm_FunctionEntity.cs Voir le fichier

@@ -62,6 +62,11 @@ namespace Learun.Application.TwoDevelopment.Permission
[Column("FISMANAGEPAGE")]
public bool? FIsManagePage { get; set; }
/// <summary>
/// 是否手机端
/// </summary>
[Column("FISH5")]
public bool? FIsH5 { get; set; }
/// <summary>
/// FEnabled
/// </summary>
[Column("FENABLED")]


Chargement…
Annuler
Enregistrer