diff --git a/EProject/BLL/AccessTokenModel.cs b/EProject/BLL/AccessTokenModel.cs new file mode 100644 index 0000000..535f944 --- /dev/null +++ b/EProject/BLL/AccessTokenModel.cs @@ -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; } + } +} diff --git a/EProject/BLL/BLL.csproj b/EProject/BLL/BLL.csproj index d658161..3fcd25b 100644 --- a/EProject/BLL/BLL.csproj +++ b/EProject/BLL/BLL.csproj @@ -95,6 +95,7 @@ + diff --git a/EProject/BLL/Common/HttpHelper.cs b/EProject/BLL/Common/HttpHelper.cs index 420aa37..23b9cea 100644 --- a/EProject/BLL/Common/HttpHelper.cs +++ b/EProject/BLL/Common/HttpHelper.cs @@ -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) { diff --git a/EProject/BLL/Funs.cs b/EProject/BLL/Funs.cs index 90eb6fa..70eaad4 100644 --- a/EProject/BLL/Funs.cs +++ b/EProject/BLL/Funs.cs @@ -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; + } /// /// ΪĿ "ѡ" diff --git a/EProject/FineUIPro.Web/ErrLog.txt b/EProject/FineUIPro.Web/ErrLog.txt index 5587785..a5c4f46 100644 --- a/EProject/FineUIPro.Web/ErrLog.txt +++ b/EProject/FineUIPro.Web/ErrLog.txt @@ -1504,3 +1504,33 @@ ldap验证 不走域账号登录 q.Count=1 登录成功 +登录之前获取账号密码为:account=huw22,password=gly.1234 +走域账号登录 +auth.CheckPassword 验证密码 +lock锁这里 +ldap验证 +捕获异常信息:LDAP 服务器不可用。 +域账号登录失败:LDAP 服务器不可用。 +不走域账号登录 +q.Count=1 +登录成功 +登录之前获取账号密码为:account=huw22,password=gly.1234 +走域账号登录 +auth.CheckPassword 验证密码 +lock锁这里 +ldap验证 +捕获异常信息:LDAP 服务器不可用。 +域账号登录失败:LDAP 服务器不可用。 +不走域账号登录 +q.Count=1 +登录成功 +登录之前获取账号密码为:account=huw22,password=gly.1234 +走域账号登录 +auth.CheckPassword 验证密码 +lock锁这里 +ldap验证 +捕获异常信息:LDAP 服务器不可用。 +域账号登录失败:LDAP 服务器不可用。 +不走域账号登录 +q.Count=1 +登录成功 diff --git a/EProject/FineUIPro.Web/FineUIPro.Web.csproj b/EProject/FineUIPro.Web/FineUIPro.Web.csproj index 28e388e..4c345a2 100644 --- a/EProject/FineUIPro.Web/FineUIPro.Web.csproj +++ b/EProject/FineUIPro.Web/FineUIPro.Web.csproj @@ -62,7 +62,19 @@ ..\packages\SharpZipLib.1.3.2\lib\net45\ICSharpCode.SharpZipLib.dll + + ..\packages\Microsoft.Bcl.AsyncInterfaces.1.1.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll + + + ..\packages\Microsoft.IdentityModel.Abstractions.7.6.2\lib\net472\Microsoft.IdentityModel.Abstractions.dll + + + ..\packages\Microsoft.IdentityModel.Logging.7.6.2\lib\net472\Microsoft.IdentityModel.Logging.dll + + + ..\packages\Microsoft.IdentityModel.Tokens.7.6.2\lib\net472\Microsoft.IdentityModel.Tokens.dll + ..\packages\Microsoft.ReportingServices.ReportViewerControl.WebForms.150.900.148\lib\net40\Microsoft.ReportViewer.Common.dll @@ -103,13 +115,39 @@ ..\packages\NPOI.2.5.5\lib\net45\NPOI.OpenXmlFormats.dll + + ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll + + + ..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll + + + + + ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll + + + ..\packages\System.Runtime.CompilerServices.Unsafe.4.7.1\lib\net461\System.Runtime.CompilerServices.Unsafe.dll + + + ..\packages\System.Text.Encodings.Web.4.7.2\lib\net461\System.Text.Encodings.Web.dll + + + ..\packages\System.Text.Json.4.7.2\lib\net461\System.Text.Json.dll + + + ..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll + + + ..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll + @@ -551,8 +589,7 @@ - - + @@ -565,6 +602,7 @@ + @@ -1808,6 +1846,13 @@ SelectUserControl.ascx + + ssocallback.aspx + ASPXCodeBehind + + + ssocallback.aspx + index.aspx ASPXCodeBehind diff --git a/EProject/FineUIPro.Web/Global.asax.cs b/EProject/FineUIPro.Web/Global.asax.cs index 3b6ff11..4502b7c 100644 --- a/EProject/FineUIPro.Web/Global.asax.cs +++ b/EProject/FineUIPro.Web/Global.asax.cs @@ -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"); diff --git a/EProject/FineUIPro.Web/Login.aspx b/EProject/FineUIPro.Web/Login.aspx index 0da0c47..4430b00 100644 --- a/EProject/FineUIPro.Web/Login.aspx +++ b/EProject/FineUIPro.Web/Login.aspx @@ -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"> - + + FA + + @@ -161,6 +164,20 @@ style="display: none; position: relative; margin-top: 20px;"> + + + + + + 快速登录 + + + + @@ -168,6 +185,7 @@