diff --git a/FCL/BLL/Common/HttpHelper.cs b/FCL/BLL/Common/HttpHelper.cs index ce7fd27..15c9871 100644 --- a/FCL/BLL/Common/HttpHelper.cs +++ b/FCL/BLL/Common/HttpHelper.cs @@ -15,12 +15,12 @@ namespace BLL.Common /// /// /// - 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"); } diff --git a/FCL/FineUIPro.Web/FineUIPro.Web.csproj b/FCL/FineUIPro.Web/FineUIPro.Web.csproj index 5bafc10..f91eb81 100644 --- a/FCL/FineUIPro.Web/FineUIPro.Web.csproj +++ b/FCL/FineUIPro.Web/FineUIPro.Web.csproj @@ -300,7 +300,6 @@ - @@ -313,14 +312,6 @@ - - - - - - - - @@ -358,7 +349,6 @@ - @@ -2567,7 +2557,6 @@ - @@ -2596,17 +2585,6 @@ - - FCLDS.xsd - - - Designer - MSDataSetGenerator - FCLDS.Designer.cs - - - FCLDS.xsd - @@ -3060,55 +3038,6 @@ SafetyEvaluation.aspx - - editCAD.aspx - ASPXCodeBehind - - - editCAD.aspx - - - EditOffice.aspx - ASPXCodeBehind - - - EditOffice.aspx - - - FileManageList.aspx - ASPXCodeBehind - - - FileManageList.aspx - - - Read.aspx - ASPXCodeBehind - - - Read.aspx - - - ReadCad.aspx - ASPXCodeBehind - - - ReadCad.aspx - - - Save.aspx - ASPXCodeBehind - - - Save.aspx - - - SaveCAD.aspx - ASPXCodeBehind - - - SaveCAD.aspx - Global.asax @@ -3152,22 +3081,6 @@ OperationError.aspx - - FCLDS.xsd - - - True - True - FCLDS.xsd - - - ReportPrint.aspx - ASPXCodeBehind - - - ReportPrint.aspx - - index.aspx ASPXCodeBehind @@ -3558,9 +3471,6 @@ Lan.en-US.designer.cs - - - diff --git a/FCL/FineUIPro.Web/Global.asax.cs b/FCL/FineUIPro.Web/Global.asax.cs index 17f9ff2..c67b37c 100644 --- a/FCL/FineUIPro.Web/Global.asax.cs +++ b/FCL/FineUIPro.Web/Global.asax.cs @@ -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(result); - //if (obj.code == 200) - //{ - // //成功 - //} + } } } diff --git a/FCL/FineUIPro.Web/Login.aspx b/FCL/FineUIPro.Web/Login.aspx index 3e3f74e..dd368d9 100644 --- a/FCL/FineUIPro.Web/Login.aspx +++ b/FCL/FineUIPro.Web/Login.aspx @@ -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"; diff --git a/FCL/FineUIPro.Web/Web.config b/FCL/FineUIPro.Web/Web.config index 47a5b53..0d03a60 100644 --- a/FCL/FineUIPro.Web/Web.config +++ b/FCL/FineUIPro.Web/Web.config @@ -9,7 +9,7 @@
- + diff --git a/FCL/FineUIPro.Web/ssocallback.aspx.cs b/FCL/FineUIPro.Web/ssocallback.aspx.cs index 0d93c15..c81ac9a 100644 --- a/FCL/FineUIPro.Web/ssocallback.aspx.cs +++ b/FCL/FineUIPro.Web/ssocallback.aspx.cs @@ -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(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; } + + } } \ No newline at end of file diff --git a/FCL/WebApi/Web.config b/FCL/WebApi/Web.config index 780d168..d824706 100644 --- a/FCL/WebApi/Web.config +++ b/FCL/WebApi/Web.config @@ -10,7 +10,7 @@ - +