This commit is contained in:
佘春生 2024-06-24 10:30:14 +08:00
commit 8fa946eba1
20 changed files with 396 additions and 11047 deletions

1
.gitignore vendored
View File

@ -1045,3 +1045,4 @@ EProject/WebApi/obj/Release/WebApi.pdb
/EProject/Model/.vs
/EProject/WebApi/.vs
/EProject/WebApi/obj
/EProject/packages

View File

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BLL.Common
{
public class AccessTokenModel
{
public string token_type { get; set; }
public string scope { get; set; }
public int expires_in { get; set; }
public int ext_expires_in { get; set; }
public string access_token { get; set; }
public string refresh_token { get; set; }
public string id_token { get; set; }
}
}

View File

@ -95,6 +95,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AccessTokenModel.cs" />
<Compile Include="APIService\APIEpojectService.cs" />
<Compile Include="APIService\SyncUserInfoService.cs" />
<Compile Include="BaseInfo\ActTypeService.cs" />

View File

@ -3,6 +3,8 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
@ -55,6 +57,40 @@ namespace BLL.Common
}
return strPostReponse;
}
private static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
{
return true; //总是接受
}
public static string PostJsonByHttps(string url, string jsonParams)
{
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
HttpWebRequest request = null;
CookieContainer cookie = new CookieContainer();
//HTTPSQ请求
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);
request = WebRequest.Create(url) as HttpWebRequest;
request.CookieContainer = cookie;
request.ProtocolVersion = HttpVersion.Version11;
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.KeepAlive = true;
byte[] byteData = Encoding.UTF8.GetBytes(jsonParams);
int length = byteData.Length;
request.ContentLength = length;
using (Stream stream = request.GetRequestStream())
{
stream.Write(byteData, 0, byteData.Length);
}
var response = (HttpWebResponse)request.GetResponse();
using (StreamReader st = new StreamReader(response.GetResponseStream(), Encoding.GetEncoding("utf-8")))
{
return st.ReadToEnd().ToString();
}
}
private static HttpWebRequest CreateHttpRequest(string url, string requestType, string token, params object[] strJson)
{

View File

@ -123,6 +123,26 @@ namespace BLL
DDL.Items.Insert(0, new System.Web.UI.WebControls.ListItem(itemText, BLL.Const._Null));
return;
}
// 单点登陆ClientId参数
public static string ClientId
{
get;
set;
}
// 单点登陆ClientSecret参数
public static string ClientSecret
{
get;
set;
}
// 单点登陆Redirect_url参数
public static string Redirect_url
{
get;
set;
}
/// <summary>
/// 为目标下拉框加上 "请选择" 项

View File

@ -55,13 +55,26 @@
<Reference Include="BouncyCastle.Crypto, Version=1.8.9.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
<HintPath>..\packages\Portable.BouncyCastle.1.8.9\lib\net40\BouncyCastle.Crypto.dll</HintPath>
</Reference>
<Reference Include="FineUIPro">
<HintPath>..\FineUIPro\FineUIPro.dll</HintPath>
<Reference Include="FineUIPro, Version=7.1.0.0, Culture=neutral, PublicKeyToken=9cbe753c029f291a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>bin\FineUIPro.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.SharpZipLib, Version=1.3.2.10, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
<HintPath>..\packages\SharpZipLib.1.3.2\lib\net45\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.1.1.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.IdentityModel.Abstractions, Version=7.6.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.IdentityModel.Abstractions.7.6.2\lib\net472\Microsoft.IdentityModel.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.IdentityModel.Logging, Version=7.6.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.IdentityModel.Logging.7.6.2\lib\net472\Microsoft.IdentityModel.Logging.dll</HintPath>
</Reference>
<Reference Include="Microsoft.IdentityModel.Tokens, Version=7.6.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.IdentityModel.Tokens.7.6.2\lib\net472\Microsoft.IdentityModel.Tokens.dll</HintPath>
</Reference>
<Reference Include="Microsoft.JScript" />
<Reference Include="Microsoft.ReportViewer.Common, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.ReportingServices.ReportViewerControl.WebForms.150.900.148\lib\net40\Microsoft.ReportViewer.Common.dll</HintPath>
@ -102,13 +115,39 @@
<Reference Include="NPOI.OpenXmlFormats, Version=2.5.5.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
<HintPath>..\packages\NPOI.2.5.5\lib\net45\NPOI.OpenXmlFormats.dll</HintPath>
</Reference>
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data.Linq" />
<Reference Include="System.DirectoryServices" />
<Reference Include="System.DirectoryServices.Protocols" />
<Reference Include="System.Management" />
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http" />
<Reference Include="System.Numerics" />
<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>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.6.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.7.1\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Text.Encodings.Web, Version=4.0.5.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Encodings.Web.4.7.2\lib\net461\System.Text.Encodings.Web.dll</HintPath>
</Reference>
<Reference Include="System.Text.Json, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Json.4.7.2\lib\net461\System.Text.Json.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Web.DataVisualization" />
<Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web.Entity" />
@ -550,8 +589,7 @@
<Content Include="res\themes\pure_red\theme.css" />
<Content Include="Scripts\ajax.js" />
<Content Include="Scripts\index.aspx" />
<Content Include="Scripts\jquery-3.6.4.js" />
<Content Include="Scripts\jquery-3.6.4.min.js" />
<Content Include="Scripts\jquery-3.7.1.min.js" />
<Content Include="Scripts\jquery.min.js" />
<Content Include="Scripts\md5.js" />
<Content Include="Scripts\percent.js" />
@ -564,6 +602,7 @@
<Content Include="Email_Send\Email_Send_Edit.aspx" />
<Content Include="Email_Send\SelectRoleControl.ascx" />
<Content Include="Email_Send\SelectUserControl.ascx" />
<Content Include="ssocallback.aspx" />
<Content Include="Styles\index.aspx" />
<Content Include="SysManage\ActualManHourMonthSet.aspx" />
<Content Include="SysManage\DataBackup.aspx" />
@ -1807,6 +1846,13 @@
<Compile Include="Email_Send\SelectUserControl.ascx.designer.cs">
<DependentUpon>SelectUserControl.ascx</DependentUpon>
</Compile>
<Compile Include="ssocallback.aspx.cs">
<DependentUpon>ssocallback.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="ssocallback.aspx.designer.cs">
<DependentUpon>ssocallback.aspx</DependentUpon>
</Compile>
<Compile Include="Styles\index.aspx.cs">
<DependentUpon>index.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>

View File

@ -26,6 +26,9 @@
try
{
Funs.RootPath = Server.MapPath("~/");
Funs.ClientId = ConfigurationManager.AppSettings["clientId"];
Funs.ClientSecret = ConfigurationManager.AppSettings["clientSecret"];
Funs.Redirect_url = ConfigurationManager.AppSettings["redirect_url"];
// 日志文件所在目录
ErrLogInfo.DefaultErrLogFullPath = Server.MapPath("~/ErrLog.txt");

View File

@ -45,8 +45,11 @@
src="res/index/images/loginBg.jpg"
style="width: auto; height: 335px; width: 355px; position: absolute; flex-shrink: 0; margin: 0px; border-radius: 10px; box-shadow: 0px 20px 20px #1b1b2a">
</div>
<div class="bi-vertical-layout"
style="overflow: hidden auto; left: 40px; right: 40px; top: 0px; bottom: 0px; position: absolute;">
<div style="width: 100px; height: 100px; position: absolute; border-radius:10px;top:0px ;right: -6px;background-image:url(/res/images/sanjiao.png);background-size:cover">
<div id="pointd" style="font-size:26px; color:#FFF;text-align:center;position:relative;width:50px;left:45px;top:15px;cursor:pointer;">FA</div>
</div>
<div id="loginpwd" class="bi-vertical-layout"
style="overflow: hidden auto; display:none; left: 40px; right: 40px; top: 0px; bottom: 0px; position: absolute;">
<div class="bi-vertical-layout" style="overflow: hidden auto; position: relative; margin-top: 50px; border-color: #fff">
<div class="dec-login-item bi-vertical-layout"
style="overflow: hidden auto; position: relative; margin-bottom: 10px;">
@ -161,6 +164,20 @@
style="display: none; position: relative; margin-top: 20px;">
</div>
</div>
<div id="fasklogin" class="bi-vertical-layout"
style="overflow: hidden auto; left: 40px; right: 40px; top: 0px; bottom: 0px; position: absolute;">
<div style="height:150px;"></div>
<div class="bi-horizon-auto-layout" style="position: relative;">
<div
class="bi-single bi-basic-button cursor-pointer bi-button login-button button-common bi-label bi-flex-center-adapt-layout"
style="width: 190px; height: 40px; line-height: 38px; min-width: 80px; position: relative; margin: 0px auto; box-shadow: 0px 10px 20px #2d2353">
<div id="faskloginUrl" class="bi-single bi-text"
style="padding-left: 10px; padding-right: 10px; max-width: 100%; text-align: left; white-space: nowrap; text-overflow: ellipsis; position: relative; flex-shrink: 0; margin: 0px; font-weight: bold">
快速登录
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@ -168,6 +185,7 @@
</div>
</div>
</body>
<script src="Scripts/jquery-3.7.1.min.js"></script>
<script src="Scripts/md5.js"></script>
<script src="Scripts/ajax.js"></script>
<script type="text/javascript">
@ -188,26 +206,7 @@
var pwd = localStorage.getItem("p")
document.getElementById("user").value = user;
document.getElementById("pwd").value = pwd;
//document.getElementById("user").value = user;
////if (user != "") {
//// Ajax().get({
//// url: 'GetUserInfo.aspx',
//// data: {
//// "action": "get",
//// "useraccount": user
//// },
//// success: function (res) {
//// console.log(res);
//// var res = JSON.parse(res);
//// if (res.Code == "1") {
//// document.getElementById("pwd").value = res.Data;
//// } else {
//// console.log(res.Message);
//// }
//// }
//// })
////}
function login() {
var user = document.getElementById("user").value;
@ -217,9 +216,6 @@
return;
}
//if (pwd.length < 32) {
// pwd = md5(pwd, 32);
//}
Ajax().post({
url: 'loginApi.aspx',
data: {
@ -242,6 +238,27 @@
}
});
}
$("#pointd").click(function () {
if ($("#loginpwd").css("display") == "none") {
$("#fasklogin").css("display", "none");
$("#loginpwd").css("display", "block");
$("#pointd").text("FA");
} else {
$("#fasklogin").css("display", "block");
$("#loginpwd").css("display", "none");
$("#pointd").text("ID");
}
})
$("#faskloginUrl").click(function () {
let clientId = '<%= BLL.Funs.ClientId %>';
let url = "https://login.microsoftonline.com/ecaa386b-c8df-4ce0-ad01-740cbdb5ba55/oauth2/v2.0/authorize";
let response_type = "code";
let redirect_url = encodeURIComponent('<%= BLL.Funs.Redirect_url %>');
let scope = "openid profile";
let response_mode = "query";
let state = "state123";
let ssourl = url + "?client_id=" + clientId + "&response_type=" + response_type + "&redirect_uri=" + redirect_url + "&scope=" + scope + "&response_mode=" + response_mode + "&state=" + state;
location.href = ssourl;
})
</script>
</html>

View File

@ -6,7 +6,7 @@
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>人工时统计</title>
<script src="../Scripts/jquery-3.6.4.js"></script>
<script src="../Scripts/jquery-3.7.1.min.js"></script>
<script src="../res/echarts/echarts.js"></script>
</head>
<body>

View File

@ -6,7 +6,7 @@
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>人工时统计</title>
<script src="../Scripts/jquery-3.6.4.js"></script>
<script src="../Scripts/jquery-3.7.1.min.js"></script>
<script src="../res/echarts/echarts.js"></script>
</head>
<body>

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
<?xml version="1.0"?>
<?xml version="1.0" encoding="utf-8"?>
<!--
有关如何配置 ASP.NET 应用程序的详细消息,请访问
@ -6,23 +6,26 @@
-->
<configuration>
<configSections>
<section name="FineUIPro" type="FineUIPro.ConfigSection, FineUIPro" requirePermission="false"/>
<section name="FineUIPro" type="FineUIPro.ConfigSection, FineUIPro" requirePermission="false" />
</configSections>
<connectionStrings>
<add name="EProjectDBConnectionString" connectionString="Data Source=.\sql2016;Initial Catalog=EProjectDB;uid=sa;pwd=1111;"/>
<add name="EProjectDBConnectionString" connectionString="Data Source=.;Initial Catalog=EProjectDB;uid=sa;pwd=Sh@nghai9;" />
<!--<add name="HJGLDBConnectionString" connectionString="Data Source=.;Initial Catalog=EProjectDB;Integrated Security=True"
providerName="System.Data.SqlClient" />-->
</connectionStrings>
<FineUIPro DebugMode="false" CustomTheme="Metro_Dark_Blue" EnableAnimation="true" JSLibrary="All"/>
<FineUIPro DebugMode="false" CustomTheme="Metro_Dark_Blue" EnableAnimation="true" JSLibrary="All" />
<appSettings>
<!--连接字符串-->
<!--<add key="ConnectionString" value="Server=.;Database=EProjectDB;Integrated Security=False; User ID=sa;Password=1111;MultipleActiveResultSets=true;Max Pool Size = 1000;Connect Timeout=1200"/>-->
<!--系统名称-->
<add key="SystemName" value="EProject"/>
<add key="ChartImageHandler" value="storage=file;timeout=20;url=~/Images/;"/>
<add key="aspnet:MaxHttpCollectionKeys" value="50000"/>
<add key="Https" value="false"/>
<add key="LdapUrl" value="10.4.21.240"/>
<add key="clientId" value="9fceb83b-fe0b-4374-8a94-6ee1ea46b2b6" />
<add key="clientSecret" value="7LI8Q~EfN~XB26vvDzLUaJlH8Uq.CG9p-JA5KbcY" />
<add key="redirect_url" value="https://eproject.basf-ypc.net.cn/ssocallback.aspx" />
<add key="SystemName" value="EProject" />
<add key="ChartImageHandler" value="storage=file;timeout=20;url=~/Images/;" />
<add key="aspnet:MaxHttpCollectionKeys" value="50000" />
<add key="Https" value="false" />
<add key="LdapUrl" value="10.4.21.240" />
</appSettings>
<!--
有关 web.config 更改的说明,请参见 http://go.microsoft.com/fwlink/?LinkId=235367。
@ -34,21 +37,21 @@
-->
<system.web>
<!-- 会话状态设置 默认情况下ASP.NET 使用 Cookie 来标识哪些请求属于特定的会话。如果 Cookie 不可用,则可以通过将会话标识符添加到 URL 来跟踪会话。若要禁用 Cookie请设置 sessionState cookieless="true" -->
<sessionState mode="InProc" cookieless="UseCookies" timeout="1200"/>
<sessionState mode="InProc" cookieless="UseCookies" timeout="1200" />
<!--<processModel enable="true" requestQueueLimit="100000"/>-->
<pages controlRenderingCompatibilityVersion="4.0" clientIDMode="AutoID" viewStateEncryptionMode="Always">
<controls>
<add tagPrefix="f" namespace="FineUIPro" assembly="FineUIPro"/>
<add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting" assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add tagPrefix="f" namespace="FineUIPro" assembly="FineUIPro" />
<add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting" assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</controls>
</pages>
<httpModules>
<add name="FineUIProScriptModule" type="FineUIPro.ScriptModule, FineUIPro"/>
<add name="FineUIProScriptModule" type="FineUIPro.ScriptModule, FineUIPro" />
</httpModules>
<httpHandlers>
<add path="res.axd" verb="GET" type="FineUIPro.ResourceHandler, FineUIPro" validate="false"/>
<add path="ChartImg.axd" verb="GET,POST,HEAD" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
<add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91" validate="false"/>
<add path="res.axd" verb="GET" type="FineUIPro.ResourceHandler, FineUIPro" validate="false" />
<add path="ChartImg.axd" verb="GET,POST,HEAD" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" />
<add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91" validate="false" />
</httpHandlers>
<compilation debug="true" targetFramework="4.8">
<assemblies>
@ -61,81 +64,105 @@
<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
</buildProviders>-->
</compilation>
<httpRuntime requestValidationMode="2.0" maxRequestLength="2147483647" executionTimeout="36000" requestPathInvalidCharacters=""/>
<httpRuntime requestValidationMode="2.0" maxRequestLength="2147483647" executionTimeout="36000" requestPathInvalidCharacters="" />
<authentication mode="Forms">
<forms loginUrl="Login.aspx" name="PUBLISHERCOOKIE" protection="All" timeout="1440" path="/"/>
<forms loginUrl="Login.aspx" name="PUBLISHERCOOKIE" protection="All" timeout="1440" path="/" />
</authentication>
<membership>
<providers>
<clear/>
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/"/>
<clear />
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
</providers>
</membership>
<profile>
<providers>
<clear/>
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/>
<clear />
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" />
</providers>
</profile>
<roleManager enabled="false">
<providers>
<clear/>
<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/"/>
<add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/"/>
<clear />
<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" />
<add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
</providers>
</roleManager>
<customErrors defaultRedirect="LogOff.aspx" mode="RemoteOnly">
<error redirect="https://localhost/hjgl/OperationError.aspx" statusCode="404"/>
<error redirect="https://localhost/hjgl/OperationError.aspx" statusCode="404" />
</customErrors>
<!--Unencrypted __VIEWSTATE parameterviewstate 保存没有加密,解决方法-->
<!--<machineKey validation="3DES"/>-->
<!--Body Parameters Accepted in Query:https才能访问-->
<!--<httpCookies httpOnlyCookies="true" requireSSL="true"/>-->
</system.web>
<location path="res.axd"/>
<location path="res.axd" />
<system.webServer>
<staticContent>
<mimeMap fileExtension=".dat" mimeType="application/ChinaExcel Report File"/>
<mimeMap fileExtension=".tab" mimeType="application/ChinaExcel Report File"/>
<mimeMap fileExtension=".dat" mimeType="application/ChinaExcel Report File" />
<mimeMap fileExtension=".tab" mimeType="application/ChinaExcel Report File" />
</staticContent>
<httpProtocol>
<customHeaders>
<!--<add name="Content-Security-Policy" value="default-src 'self'"/>-->
<remove name="X-Powered-By"/>
<remove name="X-Powered-By" />
<!--SAMEORIGIN表示该页面可以在相同域名页面的 frame 中展示-->
<add name="X-XSS-Protection" value="1;mode=block"/>
<add name="X-Frame-Options" value="SAMEORIGIN"/>
<add name="X-Content-Type-Options" value="nosniff"/>
<add name="Strict-Transport-Security" value="max-age=31536000"/>
<add name="X-XSS-Protection" value="1;mode=block" />
<add name="X-Frame-Options" value="SAMEORIGIN" />
<add name="X-Content-Type-Options" value="nosniff" />
<add name="Strict-Transport-Security" value="max-age=31536000" />
</customHeaders>
</httpProtocol>
<validation validateIntegratedModeConfiguration="false"/>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true">
<add name="FineUIProScriptModule" type="FineUIPro.ScriptModule, FineUIPro"/>
<remove name="ScriptModule"/>
<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="FineUIProScriptModule" type="FineUIPro.ScriptModule, FineUIPro" />
<remove name="ScriptModule" />
<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</modules>
<handlers>
<remove name="ChartImageHandler"/>
<add name="FineUIProResourceHandler" verb="GET" path="res.axd" type="FineUIPro.ResourceHandler, FineUIPro"/>
<add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD,POST" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
<remove name="ChartImageHandler" />
<add name="FineUIProResourceHandler" verb="GET" path="res.axd" type="FineUIPro.ResourceHandler, FineUIPro" />
<add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD,POST" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
</handlers>
<defaultDocument>
<files>
<add value="Login.aspx"/>
<add value="Login.aspx" />
</files>
</defaultDocument>
<httpErrors>
<remove statusCode="403" subStatusCode="-1"/>
<error statusCode="403" prefixLanguageFilePath="https://localhost/Eproject/" path="OperationError.aspx" responseMode="File"/>
<remove statusCode="403" subStatusCode="-1" />
<error statusCode="403" prefixLanguageFilePath="https://localhost/Eproject/" path="OperationError.aspx" responseMode="File" />
</httpErrors>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0"/>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.6.0" newVersion="4.0.6.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Text.Encodings.Web" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.5.1" newVersion="4.0.5.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>

View File

@ -7,7 +7,7 @@
<head id="Head1" runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script src="../Scripts/jquery-3.6.4.js"></script>
<script src="../Scripts/jquery-3.7.1.min.js"></script>
<script src="../res/echarts/echarts.js"></script>
<style>
/* 限定[项目名称]列自动换行,其他列不自动换行 */

View File

@ -1,9 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Bcl.AsyncInterfaces" version="1.1.0" targetFramework="net48" />
<package id="Microsoft.IdentityModel.Abstractions" version="7.6.2" targetFramework="net48" />
<package id="Microsoft.IdentityModel.Logging" version="7.6.2" targetFramework="net48" />
<package id="Microsoft.IdentityModel.Tokens" version="7.6.2" targetFramework="net48" />
<package id="Microsoft.ReportingServices.ReportViewerControl.WebForms" version="150.900.148" targetFramework="net40" />
<package id="Microsoft.SqlServer.Types" version="14.0.1016.290" targetFramework="net40" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net461" />
<package id="NPOI" version="2.5.5" targetFramework="net461" />
<package id="Portable.BouncyCastle" version="1.8.9" targetFramework="net461" />
<package id="SharpZipLib" version="1.3.2" targetFramework="net461" />
<package id="System.Buffers" version="4.5.1" targetFramework="net48" />
<package id="System.Memory" version="4.5.5" targetFramework="net48" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net48" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.7.1" targetFramework="net48" />
<package id="System.Text.Encodings.Web" version="4.7.2" targetFramework="net48" />
<package id="System.Text.Json" version="4.7.2" targetFramework="net48" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net48" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net48" />
</packages>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -0,0 +1 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ssocallback.aspx.cs" Inherits="FineUIPro.Web.ssocallback" %>

View File

@ -0,0 +1,108 @@
using BLL;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.IdentityModel.Tokens;
using BLL.Common;
namespace FineUIPro.Web
{
public partial class ssocallback : System.Web.UI.Page
{
private string code = string.Empty;
protected void Page_Load(object sender, EventArgs e)
{
this.code = Request.Params["code"];
//BLL.ErrLogInfo.WriteLog($"获取code={this.code}");
if (string.IsNullOrEmpty(this.code))
{
Response.Redirect("~/login.aspx");
return;
}
var token = GetAccessToken(this.code);
var userInfo = getUserInfo(token);
if (userInfo == null)
{
Response.Redirect("~/login.aspx");
return;
}
Response.Redirect("~/index.aspx");
}
private AccessTokenModel GetAccessToken(string _code)
{
string clientId = Funs.ClientId;
string clientSecret = Funs.ClientSecret;
string redirect_url = Funs.Redirect_url;
string grant_type = "authorization_code";
string scope = "profile openid";
string baseUrl = $"https://login.microsoftonline.com/ecaa386b-c8df-4ce0-ad01-740cbdb5ba55/oauth2/v2.0/token";
try
{
string postData = $"code={code}&client_id={clientId}&client_secret={clientSecret}&grant_type={grant_type}&redirect_uri={redirect_url}&scope={scope}";
//BLL.ErrLogInfo.WriteLog($"请求参数postData={postData}");
string result = BLL.Common.HttpHelper.PostJsonByHttps(baseUrl, postData);
//BLL.ErrLogInfo.WriteLog($"请求API Result={result}");
var Data = JsonConvert.DeserializeObject<AccessTokenModel>(result);
return Data;
}
catch (Exception ex)
{
ErrLogInfo.WriteLog(ex.Message);
}
return null;
}
private Model.Sys_User getUserInfo(AccessTokenModel token)
{
try
{
string username = string.Empty;
string[] toke_split = token.id_token.Split('.');
var header = Encoding.UTF8.GetString(Base64UrlEncoder.DecodeBytes(toke_split[0]));
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();
}
else
{
if (jo["preferred_username"] != null)
{
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();
if (info != null)
{
FormsAuthentication.SetAuthCookie(username, false);
Session[SessionName.CurrUser] = info;
}
return info;
}
catch (Exception ex)
{
//这里报错了,写入日志
BLL.ErrLogInfo.WriteLog(ex.Message);
}
return null;
}
}
}

View File

@ -0,0 +1,17 @@
//------------------------------------------------------------------------------
// <自动生成>
// 此代码由工具生成。
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </自动生成>
//------------------------------------------------------------------------------
namespace FineUIPro.Web
{
public partial class ssocallback
{
}
}