This commit is contained in:
jackchenyang 2024-06-03 14:52:50 +08:00
parent 5bcbc8e9af
commit d38dc202af
7 changed files with 52 additions and 113 deletions

View File

@ -15,12 +15,12 @@ namespace BLL.Common
/// </summary>
/// <param name="url"></param>
/// <returns></returns>
public static string HttpGetRequest(string url)
public static string HttpGetRequest(string url, string token ="")
{
string strGetResponse = string.Empty;
try
{
var getRequest = CreateHttpRequest(url,"GET", "");
var getRequest = CreateHttpRequest(url,"GET", token);
var getResponse = getRequest.GetResponse() as HttpWebResponse;
strGetResponse = GetHttpResponse(getResponse, "GET");
}

View File

@ -300,7 +300,6 @@
<Content Include="Controls\My97DatePicker\开发包\skin\whyGreen\datepicker.css" />
<Content Include="Controls\My97DatePicker\开发包\skin\whyGreen\img.gif" />
<Content Include="Controls\ProgressBox.ascx" />
<Content Include="ErrLog.txt" />
<Content Include="App_Themes\Default\Default.css" />
<Content Include="Evaluation\ContractorEvaluation.aspx" />
<Content Include="Evaluation\ContractorEvaluationEdit.aspx" />
@ -313,14 +312,6 @@
<Content Include="Evaluation\PerformanceReport.aspx" />
<Content Include="Evaluation\SafetyEvaluation.aspx" />
<Content Include="favicon.ico" />
<Content Include="FileManage\editCAD.aspx" />
<Content Include="FileManage\EditOffice.aspx" />
<Content Include="FileManage\FileManageList.aspx" />
<Content Include="FileManage\ntko.js" />
<Content Include="FileManage\Read.aspx" />
<Content Include="FileManage\ReadCad.aspx" />
<Content Include="FileManage\Save.aspx" />
<Content Include="FileManage\SaveCAD.aspx" />
<Content Include="Global.asax" />
<Content Include="Images\dlu.gif" />
<Content Include="Images\dlu1.gif" />
@ -358,7 +349,6 @@
<Content Include="Login.aspx" />
<Content Include="AttachFile\fileupload.ashx" />
<Content Include="MyWebService.asmx" />
<Content Include="Report\ReportPrint.aspx" />
<Content Include="res\css\common.css" />
<Content Include="res\css\dashboard.css" />
<Content Include="res\css\datalist.css" />
@ -2567,7 +2557,6 @@
<None Include="Controls\My97DatePicker\开发包\vssver.scc" />
<Fakes Include="Fakes\Microsoft.ReportViewer.Common.fakes" />
<Content Include="Doc\FC操作手册.docx" />
<None Include="FileManage\uploadCADFile\Empty.dwg" />
<Content Include="File\Excel\SES Report.xlsx" />
<Content Include="File\Excel\SES ReportToCPT.xlsx" />
<Content Include="File\Excel\EvaluationReport.xls" />
@ -2596,17 +2585,6 @@
<Content Include="SES\SESReport.ashx" />
<Content Include="res\images\logo\logo.psd" />
<Content Include="res\images\logo\logo_127.psd" />
<Content Include="Report\FCLDS.xsc">
<DependentUpon>FCLDS.xsd</DependentUpon>
</Content>
<None Include="Report\FCLDS.xsd">
<SubType>Designer</SubType>
<Generator>MSDataSetGenerator</Generator>
<LastGenOutput>FCLDS.Designer.cs</LastGenOutput>
</None>
<Content Include="Report\FCLDS.xss">
<DependentUpon>FCLDS.xsd</DependentUpon>
</Content>
<Content Include="res\index\css\font\digifacewide.ttf" />
<Content Include="res\index\css\font\iconfont.eot" />
<Content Include="res\index\css\font\iconfont.ttf" />
@ -3060,55 +3038,6 @@
<Compile Include="Evaluation\SafetyEvaluation.aspx.designer.cs">
<DependentUpon>SafetyEvaluation.aspx</DependentUpon>
</Compile>
<Compile Include="FileManage\editCAD.aspx.cs">
<DependentUpon>editCAD.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="FileManage\editCAD.aspx.designer.cs">
<DependentUpon>editCAD.aspx</DependentUpon>
</Compile>
<Compile Include="FileManage\EditOffice.aspx.cs">
<DependentUpon>EditOffice.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="FileManage\EditOffice.aspx.designer.cs">
<DependentUpon>EditOffice.aspx</DependentUpon>
</Compile>
<Compile Include="FileManage\FileManageList.aspx.cs">
<DependentUpon>FileManageList.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="FileManage\FileManageList.aspx.designer.cs">
<DependentUpon>FileManageList.aspx</DependentUpon>
</Compile>
<Compile Include="FileManage\Read.aspx.cs">
<DependentUpon>Read.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="FileManage\Read.aspx.designer.cs">
<DependentUpon>Read.aspx</DependentUpon>
</Compile>
<Compile Include="FileManage\ReadCad.aspx.cs">
<DependentUpon>ReadCad.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="FileManage\ReadCad.aspx.designer.cs">
<DependentUpon>ReadCad.aspx</DependentUpon>
</Compile>
<Compile Include="FileManage\Save.aspx.cs">
<DependentUpon>Save.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="FileManage\Save.aspx.designer.cs">
<DependentUpon>Save.aspx</DependentUpon>
</Compile>
<Compile Include="FileManage\SaveCAD.aspx.cs">
<DependentUpon>SaveCAD.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="FileManage\SaveCAD.aspx.designer.cs">
<DependentUpon>SaveCAD.aspx</DependentUpon>
</Compile>
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>
</Compile>
@ -3152,22 +3081,6 @@
<DependentUpon>OperationError.aspx</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Report\FCLDS.cs">
<DependentUpon>FCLDS.xsd</DependentUpon>
</Compile>
<Compile Include="Report\FCLDS.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>FCLDS.xsd</DependentUpon>
</Compile>
<Compile Include="Report\ReportPrint.aspx.cs">
<DependentUpon>ReportPrint.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Report\ReportPrint.aspx.designer.cs">
<DependentUpon>ReportPrint.aspx</DependentUpon>
</Compile>
<Compile Include="Report\ScoreDataSet.Designer.cs" />
<Compile Include="Scripts\index.aspx.cs">
<DependentUpon>index.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
@ -3558,9 +3471,6 @@
<LastGenOutput>Lan.en-US.designer.cs</LastGenOutput>
</Content>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Report\ScoreReport.rdlc" />
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Connected Services\" />
</ItemGroup>

View File

@ -1584,14 +1584,7 @@
// 回收时调用接口
protected void Application_End(object sender, EventArgs e)
{
//调用接口
string baseUrl = "https://fcl-test.basf-ypc.net.cn/api/api/DataSyncUserInfo/GetHrInfoList";
BLL.Common.HttpHelper.HttpGetRequest(baseUrl);
//var obj = JsonConvert.DeserializeObject<dynamic>(result);
//if (obj.code == 200)
//{
// //成功
//}
}
}
}

View File

@ -225,7 +225,7 @@
})
$("#faskloginUrl").click(function () {
let url = "https://login.microsoftonline.com/ecaa386b-c8df-4ce0-ad01-740cbdb5ba55/oauth2/v2.0/authorize";
let clientId = "a7977a3e-06b5-4dfc-bd7f-5b6825f0d846";
let clientId = "9379ad91-eef9-4956-a1ee-8b04bb3d42c8";
let response_type = "code";
let redirect_url = encodeURIComponent("http://localhost:6166/ssocallback.aspx");
let scope = "openid profile";

View File

@ -9,7 +9,7 @@
<section name="FineUIPro" type="FineUIPro.ConfigSection, FineUIPro" requirePermission="false"/>
</configSections>
<connectionStrings>
<add name="FCLDBConnectionString" connectionString="Data Source=.\SQL2016;Initial Catalog=FCLDB;uid=sa;pwd=1111;" providerName="System.Data.SqlClient"/>
<add name="FCLDBConnectionString" connectionString="Data Source=.;Initial Catalog=FCLDB;uid=sa;pwd=Sh@nghai9;" providerName="System.Data.SqlClient"/>
</connectionStrings>
<FineUIPro DebugMode="false" CustomTheme="Metro_Dark_Blue" EnableAnimation="true" JSLibrary="All"/>
<appSettings>

View File

@ -21,13 +21,21 @@ namespace FineUIPro.Web
Response.Redirect("~/login.aspx");
return;
}
GetAccessToken(this.code);
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 = "";
string clientSecret = "";
string clientId = "9379ad91-eef9-4956-a1ee-8b04bb3d42c8";
string clientSecret = "iLu8Q~4DRYAn~sMjvO1j.tgRERFWhILvLYRPNc9S";
string grant_type = "authorization_code";
string redirect_url = "http://localhost:6166/ssocallback.aspx";
string scope = "profile openid";
@ -53,17 +61,45 @@ namespace FineUIPro.Web
}
private void getUserInfo(string _code)
private UserTokenModel getUserInfo(AccessTokenModel token)
{
var objData = GetAccessToken(_code);
if (objData == null)
{
//退出去login页面
return;
}
string baseUrl = "https://graph.microsoft.com/oidc/userinfo";
try
{
var result = HttpHelper.HttpGetRequest(baseUrl, token.access_token);
if (result.IndexOf("sub") > -1)
{
var info = JsonConvert.DeserializeObject<UserTokenModel>(result);
//写入session信息
//写入cookie信息
return info;
}
}
catch (Exception ex)
{
//这里报错了,写入日志
BLL.ErrLogInfo.WriteLog(ex.Message);
}
return null;
}
}
public class UserTokenModel
{
public string sub { get; set; }
public string name { get; set; }
public string family_name { get; set; }
public string given_name { get; set; }
public string picture { get; set; }
public string email { get; set; }
}
}

View File

@ -10,7 +10,7 @@
<add key="ClientValidationEnabled" value="true"/>
<add key="UnobtrusiveJavaScriptEnabled" value="true"/>
<!--连接字符串-->
<add key="ConnectionString" value="Server=.\sql2016;Database=FCLDB;Integrated Security=False;User ID=sa;Password=1111;MultipleActiveResultSets=true;Connect Timeout=1200"/>
<add key="ConnectionString" value="Server=.;Database=FCLDB;Integrated Security=False;User ID=sa;Password=Sh@nghai9;MultipleActiveResultSets=true;Connect Timeout=1200"/>
<!--版本号-->
<add key="SystemVersion" value="WebApi_V2019-09-20-001"/>
<!--附件上传物理路径-->