Compare commits
No commits in common. "a878d838d1f34db2c63cc48c44b1d88ebff376eb" and "7868671ddb448490db1423fa8b52c00575a8490c" have entirely different histories.
a878d838d1
...
7868671ddb
|
@ -1196,4 +1196,3 @@ FCL/WebApi/obj/Release/WebApi.pdb
|
||||||
/FCL/FineUIPro.Web/File/Excel/20240515031759
|
/FCL/FineUIPro.Web/File/Excel/20240515031759
|
||||||
/FCL/WebApi/obj/Debug
|
/FCL/WebApi/obj/Debug
|
||||||
/FCL/packages
|
/FCL/packages
|
||||||
/FCL/FineUIPro.Web/Web.config
|
|
||||||
|
|
|
@ -138,8 +138,8 @@
|
||||||
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
|
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.6.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.7.1\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Runtime.Serialization" />
|
<Reference Include="System.Runtime.Serialization" />
|
||||||
<Reference Include="System.ServiceModel" />
|
<Reference Include="System.ServiceModel" />
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<package id="System.IdentityModel.Tokens.Jwt" version="7.6.0" targetFramework="net461" />
|
<package id="System.IdentityModel.Tokens.Jwt" version="7.6.0" targetFramework="net461" />
|
||||||
<package id="System.Memory" version="4.5.5" targetFramework="net461" />
|
<package id="System.Memory" version="4.5.5" targetFramework="net461" />
|
||||||
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net461" />
|
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net461" />
|
||||||
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net461" />
|
<package id="System.Runtime.CompilerServices.Unsafe" version="4.7.1" targetFramework="net461" />
|
||||||
<package id="System.Text.Encodings.Web" version="4.7.2" targetFramework="net461" />
|
<package id="System.Text.Encodings.Web" version="4.7.2" targetFramework="net461" />
|
||||||
<package id="System.Text.Json" version="4.7.2" targetFramework="net461" />
|
<package id="System.Text.Json" version="4.7.2" targetFramework="net461" />
|
||||||
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net461" />
|
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net461" />
|
||||||
|
|
|
@ -1,17 +1,11 @@
|
||||||
using BLL;
|
using BLL;
|
||||||
using BLL.Common;
|
using BLL.Common;
|
||||||
using Microsoft.IdentityModel.Logging;
|
|
||||||
using Microsoft.IdentityModel.Tokens;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
using Org.BouncyCastle.Utilities.Encoders;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IdentityModel.Tokens.Jwt;
|
using System.IdentityModel.Tokens.Jwt;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Security;
|
|
||||||
using System.Web.UI;
|
using System.Web.UI;
|
||||||
using System.Web.UI.WebControls;
|
using System.Web.UI.WebControls;
|
||||||
|
|
||||||
|
@ -22,7 +16,6 @@ namespace FineUIPro.Web
|
||||||
private string code = string.Empty;
|
private string code = string.Empty;
|
||||||
protected void Page_Load(object sender, EventArgs e)
|
protected void Page_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
this.code = Request.Params["code"];
|
this.code = Request.Params["code"];
|
||||||
BLL.ErrLogInfo.WriteLog($"获取code={this.code}");
|
BLL.ErrLogInfo.WriteLog($"获取code={this.code}");
|
||||||
if (string.IsNullOrEmpty(this.code))
|
if (string.IsNullOrEmpty(this.code))
|
||||||
|
@ -72,30 +65,29 @@ namespace FineUIPro.Web
|
||||||
|
|
||||||
private Model.Sys_User getUserInfo(AccessTokenModel token)
|
private Model.Sys_User getUserInfo(AccessTokenModel token)
|
||||||
{
|
{
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
var handler = new JwtSecurityTokenHandler();
|
||||||
|
var jwtToken = handler.ReadJwtToken(token.id_token);
|
||||||
string username = string.Empty;
|
string username = string.Empty;
|
||||||
string[] toke_split= token.id_token.Split('.');
|
var result = jwtToken.Claims.Where(t => t.Type == "cn").FirstOrDefault();
|
||||||
var header = Encoding.UTF8.GetString(Base64UrlEncoder.DecodeBytes(toke_split[0]));
|
if (result != null)
|
||||||
var clamis= Encoding.UTF8.GetString(Base64UrlEncoder.DecodeBytes(toke_split[1]));
|
|
||||||
BLL.ErrLogInfo.WriteLog("clamis=" + clamis);
|
|
||||||
JObject jo = JObject.Parse(clamis);
|
|
||||||
if (jo["cn"] != null)
|
|
||||||
{
|
{
|
||||||
username = jo["cn"].ToString();
|
BLL.ErrLogInfo.WriteLog("cn="+result?.Value);
|
||||||
|
username = result?.Value;
|
||||||
}
|
}
|
||||||
else
|
else{
|
||||||
|
username = jwtToken.Claims.Where(t => t.Type == "preferred_username").FirstOrDefault()?.Value;
|
||||||
|
BLL.ErrLogInfo.WriteLog("username=" + username);
|
||||||
|
if (!string.IsNullOrEmpty(username))
|
||||||
{
|
{
|
||||||
if (jo["preferred_username"] != null)
|
username = username.Split('@')[0];
|
||||||
{
|
|
||||||
string preferred_username = jo["preferred_username"].ToString();
|
|
||||||
username = preferred_username.Split('@')[0];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var info = Funs.DB.Sys_User.Where(t => t.Account == username && t.IsPost == true).FirstOrDefault();
|
var info = Funs.DB.Sys_User.Where(t => t.Account == username && t.IsPost == true).FirstOrDefault();
|
||||||
if (info != null)
|
if (info != null)
|
||||||
{
|
{
|
||||||
FormsAuthentication.SetAuthCookie(username, false);
|
|
||||||
Session[SessionName.CurrUser] = info;
|
Session[SessionName.CurrUser] = info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue