@@ -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> | |||
@@ -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).Select(m=> | |||
new | |||
{ | |||
m.FName, | |||
m.FId, | |||
}); | |||
return Success(functionlist); | |||
} | |||
/// <summary> | |||
/// 获取页面显示列表数据 | |||
@@ -157,7 +157,19 @@ | |||
"navigationBarTitleText": "统一认证" | |||
} | |||
}, | |||
// 统一应用20 | |||
{ | |||
"path": "pages/SSO/MyApp20/list", | |||
"style": { | |||
"navigationBarTitleText": "统一应用2.0" | |||
} | |||
}, | |||
{ | |||
"path": "pages/SSO/MyApp20/attestation", | |||
"style": { | |||
"navigationBarTitleText": "统一认证2.0" | |||
} | |||
}, | |||
// 通用页面 | |||
{ | |||
"path": "pages/common/select-organize", | |||
@@ -101,7 +101,8 @@ | |||
let _this = this | |||
let {UPId,UPUserName,UPPass,FId,UserId} = this | |||
if (UPUserName && UPPass) { | |||
_this.HTTP_POST('quanjiang/sso/first', {UPId,FId,UserId,UPUserName,UPPass},'加载数据时出错').then(resitem => { | |||
_this.HTTP_POST( | |||
'quanjiang/sso/first', {UPId,FId,UserId,UPUserName,UPPass},'加载数据时出错').then(resitem => { | |||
let sysid = resitem.FInterfaceUrl.slice(resitem.FInterfaceUrl.indexOf('=') + 1, resitem | |||
.FInterfaceUrl.indexOf('&')) | |||
let openid = resitem.FInterfaceUrl.slice(resitem.FInterfaceUrl.lastIndexOf('=') + 1) | |||
@@ -134,7 +135,7 @@ | |||
.title { | |||
font-size: 24rpx; | |||
text-align: center; | |||
margin-top: 50rpx; | |||
margin-top: 40rpx; | |||
color: gray; | |||
} | |||
@@ -168,31 +169,32 @@ | |||
.account { | |||
display: flex; | |||
align-items: center; | |||
margin-top: 20rpx; | |||
margin-top: 30rpx; | |||
justify-content: center; | |||
} | |||
.account view { | |||
font-size: 30rpx; | |||
font-size: 38rpx; | |||
} | |||
.account input { | |||
border: 1px solid #ccc; | |||
height: 60rpx; | |||
height: 80rpx; | |||
font-size: 30rpx; | |||
width: 380rpx; | |||
width: 450rpx; | |||
padding-left: 20rpx; | |||
} | |||
.btnwrap {} | |||
.btnwrap button { | |||
width: 40%; | |||
line-height: 40px; | |||
width: 50%; | |||
line-height: 50px; | |||
background-color: #0c86d8; | |||
text-align: center; | |||
color: #fff; | |||
border-radius: 4px; | |||
margin: 30px auto; | |||
margin: 40px auto; | |||
font-size: 40rpx; | |||
} | |||
</style> |
@@ -37,7 +37,6 @@ | |||
myList: [], | |||
editList: [], | |||
searchText: '', | |||
listitem: [], | |||
focus: false, | |||
edit: false | |||
@@ -51,7 +50,6 @@ | |||
methods: { | |||
// 页面初始化 | |||
async init() { | |||
this.LOADING('加载菜单中…') | |||
this.HTTP_GET( | |||
'quanjiang/sso/list' | |||
@@ -59,11 +57,8 @@ | |||
this.listitem = res | |||
this.HIDE_LOADING() | |||
}) | |||
}, | |||
// 点击按钮 | |||
funcListClick(item) { | |||
if(item.FInterfaceUrl.indexOf('http')!=-1){ | |||
@@ -75,15 +70,20 @@ | |||
url:`/pages/SSO/MyApp/listview?data=`+ encodeURIComponent(JSON.stringify(option)) | |||
}) | |||
}else{ | |||
let sysid = item.FInterfaceUrl.slice(item.FInterfaceUrl.indexOf('=')+1,item.FInterfaceUrl.indexOf('&')) | |||
let openid = item.FInterfaceUrl.slice(item.FInterfaceUrl.lastIndexOf ('=')+1) | |||
let FName = item.FName | |||
let dataitem = { | |||
sysid,openid,FName | |||
console.log(item.FInterfaceUrl) | |||
let FInterfaceUrldata = item.FInterfaceUrl | |||
if(FInterfaceUrldata.indexOf('sysid')!=-1 && FInterfaceUrldata.indexOf('openid')!=-1 ){ | |||
let sysid = item.FInterfaceUrl.slice(item.FInterfaceUrl.indexOf('sysid')+6,item.FInterfaceUrl.indexOf('openid')-1) | |||
let openid = item.FInterfaceUrl.slice(item.FInterfaceUrl.lastIndexOf ('openid')+7) | |||
let FName = item.FName | |||
let dataitem = { | |||
sysid,openid,FName | |||
} | |||
console.log(dataitem) | |||
uni.navigateTo({ | |||
url:`/pages/SSO/MyApp/attestation?item=${JSON.stringify(dataitem)}` | |||
}) | |||
} | |||
uni.navigateTo({ | |||
url:`/pages/SSO/MyApp/attestation?item=${JSON.stringify(dataitem)}` | |||
}) | |||
} | |||
}, | |||
@@ -0,0 +1,163 @@ | |||
<template> | |||
<view class="wrap"> | |||
<view class="imgwrap"> | |||
<image src="@/static/SSO/attes.png" mode=""></image> | |||
</view> | |||
<view class="title">IDENTITY AUTHENTICATION</view> | |||
<view class="titletext">统一身份认证平台</view> | |||
<view> | |||
<view v-if="firsttype"> | |||
<view class="loading">系统认证中,请耐心等待......</view> | |||
</view> | |||
<view v-else> | |||
<view class="logintitle">用户登录</view> | |||
<view class="logintext">首次登录,请输入账号密码。</view> | |||
<view class="account" style="margin-top: 30rpx;"> | |||
<view>账号:</view> | |||
<input v-model="UPUserName" class="uni-input" focus placeholder="请输入账号" /> | |||
</view> | |||
<view class="account"> | |||
<view>密码:</view> | |||
<input v-model="UPPass" class="uni-input" password="" placeholder="请输入密码" /> | |||
</view> | |||
<view class="btnwrap"> | |||
<button @click="register">登录</button> | |||
</view> | |||
</view> | |||
</view> | |||
</view> | |||
</template> | |||
<script> | |||
export default { | |||
data() { | |||
return { | |||
dataitem: '', | |||
FName: '', | |||
appid: '', | |||
firsttype: true, | |||
UPUserName: '', | |||
UPPass: '', | |||
UPId: '', | |||
FId: '', | |||
UserId: '' | |||
} | |||
}, | |||
onLoad(data) { | |||
this.dataitem = JSON.parse(data.item) | |||
this.FName = this.dataitem.FName; | |||
this.appid = this.dataitem.appid; | |||
setTimeout(() => { | |||
this.gotolist() | |||
}, 1000) | |||
}, | |||
methods: { | |||
gotolist() { | |||
let _this = this | |||
const { appid } = this | |||
// console.log(appid) | |||
this.HTTP_GET( | |||
'quanjiang/sso/goto20', { | |||
appid | |||
}, | |||
'加载数据时出错' | |||
).then(res => { | |||
let option = { | |||
FInterfaceUrl:res.FInterfaceUrl, | |||
FName:this.FName | |||
} | |||
uni.redirectTo({ | |||
url:`/pages/SSO/MyApp/listview?data=`+ encodeURIComponent(JSON.stringify(option)) | |||
}) | |||
}) | |||
} | |||
} | |||
} | |||
</script> | |||
<style lang="less"> | |||
.imgwrap { | |||
width: 214rpx; | |||
margin: 0 auto; | |||
padding-top: 100rpx; | |||
font-size: 0; | |||
} | |||
.imgwrap image { | |||
width: 214rpx; | |||
height: 200rpx; | |||
display: block; | |||
} | |||
.title { | |||
font-size: 24rpx; | |||
text-align: center; | |||
margin-top: 40rpx; | |||
color: gray; | |||
} | |||
.titletext { | |||
font-size: 50rpx; | |||
text-align: center; | |||
margin-top: 20rpx; | |||
} | |||
.loading { | |||
font-size: 28rpx; | |||
text-align: center; | |||
margin-top: 50rpx; | |||
color: goldenrod; | |||
} | |||
.logintitle { | |||
font-size: 36rpx; | |||
text-align: center; | |||
margin-top: 90rpx; | |||
color: gray; | |||
} | |||
.logintext { | |||
font-size: 28rpx; | |||
text-align: center; | |||
margin-top: 30rpx; | |||
color: goldenrod; | |||
} | |||
.account { | |||
display: flex; | |||
align-items: center; | |||
margin-top: 30rpx; | |||
justify-content: center; | |||
} | |||
.account view { | |||
font-size: 38rpx; | |||
} | |||
.account input { | |||
border: 1px solid #ccc; | |||
height: 80rpx; | |||
font-size: 30rpx; | |||
width: 450rpx; | |||
padding-left: 20rpx; | |||
} | |||
.btnwrap {} | |||
.btnwrap button { | |||
width: 50%; | |||
line-height: 50px; | |||
background-color: #0c86d8; | |||
text-align: center; | |||
color: #fff; | |||
border-radius: 4px; | |||
margin: 40px auto; | |||
font-size: 40rpx; | |||
} | |||
</style> |
@@ -0,0 +1,100 @@ | |||
<template> | |||
<view class="page" id="more"> | |||
<view class="function-list cu-list grid no-border col-4"> | |||
<view v-for="(item, index) in listitem" :key="index" | |||
class="cu-item text-center flex flex-wrap justify-center align-center"> | |||
<view @click="funcListClick(item)" style="backgroundColor:#62bbff;" | |||
class="app-item align-center flex flex-wrap justify-center align-center"> | |||
<l-icon type="calendar" color="white" class="text-sl" /> | |||
</view> | |||
<text>{{ item && item.FName }}</text> | |||
</view> | |||
</view> | |||
</view> | |||
</template> | |||
<script> | |||
import without from 'lodash/without' | |||
import concat from 'lodash/concat' | |||
import keyBy from 'lodash/keyBy' | |||
import mapKeys from 'lodash/mapKeys' | |||
import mapValues from 'lodash/mapValues' | |||
import groupBy from 'lodash/groupBy' | |||
export default { | |||
data() { | |||
return { | |||
allList: [], | |||
myList: [], | |||
editList: [], | |||
searchText: '', | |||
listitem: [], | |||
focus: false, | |||
edit: false | |||
} | |||
}, | |||
async onLoad() { | |||
await this.init() | |||
}, | |||
methods: { | |||
// 页面初始化 | |||
async init() { | |||
this.LOADING('加载菜单中…') | |||
this.HTTP_GET( | |||
'quanjiang/sso/list20' | |||
).then(res => { | |||
this.listitem = res | |||
this.HIDE_LOADING() | |||
}) | |||
}, | |||
// 点击按钮 | |||
funcListClick(item) { | |||
let appid = item.FId | |||
let FName = item.FName | |||
let dataitem = { | |||
appid,FName | |||
} | |||
uni.navigateTo({ | |||
url:`/pages/SSO/MyApp20/attestation?item=${JSON.stringify(dataitem)}` | |||
}) | |||
}, | |||
} | |||
} | |||
</script> | |||
<style lang="less" scoped> | |||
.function-list { | |||
padding-bottom: 0; | |||
.cu-item { | |||
.app-item { | |||
border-radius: 50%; | |||
height: 45px; | |||
width: 45px; | |||
} | |||
} | |||
} | |||
</style> | |||
<style lang="less"> | |||
#more { | |||
.function-list .cu-item text[class*='cuIcon'] { | |||
margin-top: 0 !important; | |||
} | |||
} | |||
page { | |||
// padding-top: 100rpx; | |||
} | |||
</style> |