From 47399c5d394e277bbc0a9624ac79fdbd0fbb6628 Mon Sep 17 00:00:00 2001 From: "wei.fu" <969995851@qq.com> Date: Fri, 26 Feb 2021 16:46:20 +0800 Subject: [PATCH 1/9] update README.md. --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index f36ef4a..7f97e76 100644 --- a/README.md +++ b/README.md @@ -186,6 +186,14 @@ _请知悉:经咨询CSDN官方客服得知,CSDN的授权开放平台已经 - [The OAuth 2.0 Authorization Framework](https://tools.ietf.org/html/rfc6749) - [OAuth 2.0](https://oauth.net/2/) +## 推荐一个精品源码网站 + +- [锐风资源网(C#精品源码、教程)](https://rthinkingsoft.com) +- [销售行业财务管理系统Asp.Net MVC+微信小程序](https://rthinkingsoft.com/2020/02/19/sales-finance/) +- [销客多 3.5.1微信商城 三级分销系统C#源码 ASP.NET公众号网站](https://rthinkingsoft.com/2020/02/19/hishop-3-5-1/) +- [敏捷开发框架7.0.3 旗舰版 .NET MVC 敏捷快速开发框架+权限+工作流+EF+SqlServer+MySQL+Oracle](https://rthinkingsoft.com/2020/02/19/quick-develop-7-0-3/) + + ## 关注&交流 | 公众号 | QQ群 | -- Gitee From f906c1f6a9dc465126eb24b185411a25eb073705 Mon Sep 17 00:00:00 2001 From: "wei.fu" <969995851@qq.com> Date: Fri, 26 Feb 2021 16:56:35 +0800 Subject: [PATCH 2/9] update README.md. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 7f97e76..373cca4 100644 --- a/README.md +++ b/README.md @@ -191,6 +191,7 @@ _请知悉:经咨询CSDN官方客服得知,CSDN的授权开放平台已经 - [锐风资源网(C#精品源码、教程)](https://rthinkingsoft.com) - [销售行业财务管理系统Asp.Net MVC+微信小程序](https://rthinkingsoft.com/2020/02/19/sales-finance/) - [销客多 3.5.1微信商城 三级分销系统C#源码 ASP.NET公众号网站](https://rthinkingsoft.com/2020/02/19/hishop-3-5-1/) +- [ASP.NET- 微信企业号OA办公管理系统 源码 企业号移动OA](https://rthinkingsoft.com/2020/02/19/wx-oa-enterprise/) - [敏捷开发框架7.0.3 旗舰版 .NET MVC 敏捷快速开发框架+权限+工作流+EF+SqlServer+MySQL+Oracle](https://rthinkingsoft.com/2020/02/19/quick-develop-7-0-3/) -- Gitee From 8eec268d89c8d31173ea1b7242d6e2e75557284d Mon Sep 17 00:00:00 2001 From: "wei.fu" <969995851@qq.com> Date: Sat, 27 Feb 2021 23:02:17 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=BC=94=E7=A4=BA?= =?UTF-8?q?=E9=A2=84=E8=A7=88=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/OAuth2Controller.cs | 15 +++++++++++++ Come.Web.Sample/Views/Home/Index.cshtml | 21 ------------------- Come.Web.Sample/Views/Shared/_Layout.cshtml | 5 ++--- 3 files changed, 17 insertions(+), 24 deletions(-) diff --git a/Come.Web.Sample/Controllers/OAuth2Controller.cs b/Come.Web.Sample/Controllers/OAuth2Controller.cs index a038462..bdf3ba6 100644 --- a/Come.Web.Sample/Controllers/OAuth2Controller.cs +++ b/Come.Web.Sample/Controllers/OAuth2Controller.cs @@ -53,5 +53,20 @@ namespace Come.Web.Sample.Controllers var authResponse = request.login(authCallback); return Content(JsonConvert.SerializeObject(authResponse)); } + + + /// Eleme验证授权 + /// + /// + /// + /// + public ActionResult ElemeVerification() + { + var retMsg = new + { + message = "ok" + }; + return Json(retMsg, JsonRequestBehavior.AllowGet); + } } } \ No newline at end of file diff --git a/Come.Web.Sample/Views/Home/Index.cshtml b/Come.Web.Sample/Views/Home/Index.cshtml index 5b44deb..291040e 100644 --- a/Come.Web.Sample/Views/Home/Index.cshtml +++ b/Come.Web.Sample/Views/Home/Index.cshtml @@ -100,24 +100,3 @@

-
-
-

Getting started

-

- ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that - enables a clean separation of concerns and gives you full control over markup - for enjoyable, agile development. -

-

Learn more »

-
-
-

Get more libraries

-

NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.

-

Learn more »

-
-
-

Web Hosting

-

You can easily find a web hosting company that offers the right mix of features and price for your applications.

-

Learn more »

-
-
\ No newline at end of file diff --git a/Come.Web.Sample/Views/Shared/_Layout.cshtml b/Come.Web.Sample/Views/Shared/_Layout.cshtml index 854fe25..dad2bd9 100644 --- a/Come.Web.Sample/Views/Shared/_Layout.cshtml +++ b/Come.Web.Sample/Views/Shared/_Layout.cshtml @@ -21,9 +21,8 @@ -- Gitee From e69340d956af66ce86bfcc79256b087afa8af58c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8D=E5=81=9A=E7=A0=81=E5=86=9C?= <599854767@qq.com> Date: Tue, 21 Jun 2022 10:59:54 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E5=88=B0.net5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Come.AspNetCore.Sample/Come.AspNetCore.Sample.csproj | 5 +---- Come.CollectiveOAuth/Come.CollectiveOAuth.csproj | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Come.AspNetCore.Sample/Come.AspNetCore.Sample.csproj b/Come.AspNetCore.Sample/Come.AspNetCore.Sample.csproj index 0f78a8e..c7ed7cf 100644 --- a/Come.AspNetCore.Sample/Come.AspNetCore.Sample.csproj +++ b/Come.AspNetCore.Sample/Come.AspNetCore.Sample.csproj @@ -1,13 +1,10 @@  - netcoreapp3.1 + net5.0 - - - diff --git a/Come.CollectiveOAuth/Come.CollectiveOAuth.csproj b/Come.CollectiveOAuth/Come.CollectiveOAuth.csproj index f764640..342a96d 100644 --- a/Come.CollectiveOAuth/Come.CollectiveOAuth.csproj +++ b/Come.CollectiveOAuth/Come.CollectiveOAuth.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1;netstandard2.0;net45 + net5.0;netstandard2.0;net45 false @@ -16,7 +16,7 @@ - + 4.2.13 -- Gitee From ec6584c2b0324c1bfd6bf26136b0a5235f433654 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8D=E5=81=9A=E7=A0=81=E5=86=9C?= <599854767@qq.com> Date: Tue, 21 Jun 2022 11:00:13 +0800 Subject: [PATCH 5/9] =?UTF-8?q?fix=EF=BC=9A=E7=BC=93=E5=AD=98=E4=B8=8D?= =?UTF-8?q?=E8=B5=B7=E4=BD=9C=E7=94=A8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Come.CollectiveOAuth/Cache/HttpRuntimeCache.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Come.CollectiveOAuth/Cache/HttpRuntimeCache.cs b/Come.CollectiveOAuth/Cache/HttpRuntimeCache.cs index a57bf0b..6d2b310 100644 --- a/Come.CollectiveOAuth/Cache/HttpRuntimeCache.cs +++ b/Come.CollectiveOAuth/Cache/HttpRuntimeCache.cs @@ -77,7 +77,12 @@ namespace Come.CollectiveOAuth.Cache /// /// 缓存 /// - public static IMemoryCache memoryCache => new MemoryCache(new MemoryCacheOptions() { }); + //public static IMemoryCache memoryCache => new MemoryCache(new MemoryCacheOptions() { }); + public static MemoryCache memoryCache { get; set; } + static HttpRuntimeCache() + { + memoryCache = new MemoryCache(new MemoryCacheOptions { }); + } /// /// 获取数据缓存 -- Gitee From e963bb20fe0071e9424667eb2f4c513d4199d6a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8D=E5=81=9A=E7=A0=81=E5=86=9C?= <599854767@qq.com> Date: Tue, 21 Jun 2022 15:43:50 +0800 Subject: [PATCH 6/9] update AuthRequestFactory.cs --- Come.AspNetCore.Sample/AuthRequestFactory.cs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/Come.AspNetCore.Sample/AuthRequestFactory.cs b/Come.AspNetCore.Sample/AuthRequestFactory.cs index 24c16a4..5d9a404 100644 --- a/Come.AspNetCore.Sample/AuthRequestFactory.cs +++ b/Come.AspNetCore.Sample/AuthRequestFactory.cs @@ -27,15 +27,17 @@ namespace Come.AspNetCore.Sample var defaultAuthList = typeof(DefaultAuthSourceEnum).ToList().Select(a => a.Name.ToUpper()).ToList(); foreach (var authSource in defaultAuthList) { - var clientConfig = new ClientConfig(); - clientConfig.clientId = AppSettingUtils.GetStrValue($"{_defaultPrefix}{authSource}_ClientId"); - clientConfig.clientSecret = AppSettingUtils.GetStrValue($"{_defaultPrefix}{authSource}_ClientSecret"); - clientConfig.redirectUri = AppSettingUtils.GetStrValue($"{_defaultPrefix}{authSource}_RedirectUri"); - clientConfig.alipayPublicKey = AppSettingUtils.GetStrValue($"{_defaultPrefix}{authSource}_AlipayPublicKey"); - clientConfig.unionId = AppSettingUtils.GetStrValue($"{_defaultPrefix}{authSource}_UnionId"); - clientConfig.stackOverflowKey = AppSettingUtils.GetStrValue($"{_defaultPrefix}{authSource}_StackOverflowKey"); - clientConfig.agentId = AppSettingUtils.GetStrValue($"{_defaultPrefix}{authSource}_AgentId"); - clientConfig.scope = AppSettingUtils.GetStrValue($"{_defaultPrefix}{authSource}_Scope"); + var clientConfig = new ClientConfig + { + clientId = AppSettingUtils.GetStrValue($"{_defaultPrefix}{authSource}_ClientId"), + clientSecret = AppSettingUtils.GetStrValue($"{_defaultPrefix}{authSource}_ClientSecret"), + redirectUri = AppSettingUtils.GetStrValue($"{_defaultPrefix}{authSource}_RedirectUri"), + alipayPublicKey = AppSettingUtils.GetStrValue($"{_defaultPrefix}{authSource}_AlipayPublicKey"), + unionId = AppSettingUtils.GetStrValue($"{_defaultPrefix}{authSource}_UnionId"), + stackOverflowKey = AppSettingUtils.GetStrValue($"{_defaultPrefix}{authSource}_StackOverflowKey"), + agentId = AppSettingUtils.GetStrValue($"{_defaultPrefix}{authSource}_AgentId"), + scope = AppSettingUtils.GetStrValue($"{_defaultPrefix}{authSource}_Scope") + }; _clientConfigs.Add(authSource, clientConfig); } #endregion -- Gitee From 0921f11ff18d0ab692179c86303db0d3c999f12f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8D=E5=81=9A=E7=A0=81=E5=86=9C?= <599854767@qq.com> Date: Sat, 25 Jun 2022 17:31:01 +0800 Subject: [PATCH 7/9] =?UTF-8?q?fex=EF=BC=9Agithub=E5=9B=9E=E8=B0=83?= =?UTF-8?q?=E5=8F=91=E9=80=81=E5=8F=82=E6=95=B0=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Come.CollectiveOAuth/Request/AuthRequests/GithubAuthRequest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Come.CollectiveOAuth/Request/AuthRequests/GithubAuthRequest.cs b/Come.CollectiveOAuth/Request/AuthRequests/GithubAuthRequest.cs index dfdf87b..f57d4da 100644 --- a/Come.CollectiveOAuth/Request/AuthRequests/GithubAuthRequest.cs +++ b/Come.CollectiveOAuth/Request/AuthRequests/GithubAuthRequest.cs @@ -82,7 +82,7 @@ namespace Come.CollectiveOAuth.Request .queryParam("response_type", "code") .queryParam("redirect_uri", config.redirectUri) .queryParam("scope", config.scope.IsNullOrWhiteSpace() ? "user" : config.scope) - .queryParam("state", getRealState(state) + "#wechat_redirect") + .queryParam("state", getRealState(state)) .build(); } -- Gitee From 6018261a30a28a0bfff37582b725bf95871aabbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8D=E5=81=9A=E7=A0=81=E5=86=9C?= <599854767@qq.com> Date: Sun, 26 Jun 2022 15:14:06 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E7=A7=BB=E9=99=A4net45?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Come.CollectiveOAuth.csproj | 25 +------------------ Come.Web.Sample.sln | 14 +++-------- 2 files changed, 5 insertions(+), 34 deletions(-) diff --git a/Come.CollectiveOAuth/Come.CollectiveOAuth.csproj b/Come.CollectiveOAuth/Come.CollectiveOAuth.csproj index 342a96d..098f81d 100644 --- a/Come.CollectiveOAuth/Come.CollectiveOAuth.csproj +++ b/Come.CollectiveOAuth/Come.CollectiveOAuth.csproj @@ -1,15 +1,10 @@  - net5.0;netstandard2.0;net45 + net5.0;netstandard2.0 false - - - - - Libraries\TopSdk.dll @@ -30,24 +25,6 @@ 4.7.0 - - - - - - - 4.2.13 - - - - - - - - - - - diff --git a/Come.Web.Sample.sln b/Come.Web.Sample.sln index b5b4fbb..d0ba221 100644 --- a/Come.Web.Sample.sln +++ b/Come.Web.Sample.sln @@ -1,13 +1,11 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29519.87 +# Visual Studio Version 17 +VisualStudioVersion = 17.2.32526.322 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Come.Web.Sample", "Come.Web.Sample\Come.Web.Sample.csproj", "{8F544C63-C74C-4C28-9120-2896C292A686}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Come.CollectiveOAuth", "Come.CollectiveOAuth\Come.CollectiveOAuth.csproj", "{6D482ED4-236A-484B-9810-DFEE702A5541}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Come.CollectiveOAuth", "Come.CollectiveOAuth\Come.CollectiveOAuth.csproj", "{6D482ED4-236A-484B-9810-DFEE702A5541}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Come.AspNetCore.Sample", "Come.AspNetCore.Sample\Come.AspNetCore.Sample.csproj", "{ED0A91E3-47C4-44D8-8F88-643B1E0C225D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Come.AspNetCore.Sample", "Come.AspNetCore.Sample\Come.AspNetCore.Sample.csproj", "{ED0A91E3-47C4-44D8-8F88-643B1E0C225D}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -15,10 +13,6 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {8F544C63-C74C-4C28-9120-2896C292A686}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8F544C63-C74C-4C28-9120-2896C292A686}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8F544C63-C74C-4C28-9120-2896C292A686}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8F544C63-C74C-4C28-9120-2896C292A686}.Release|Any CPU.Build.0 = Release|Any CPU {6D482ED4-236A-484B-9810-DFEE702A5541}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6D482ED4-236A-484B-9810-DFEE702A5541}.Debug|Any CPU.Build.0 = Debug|Any CPU {6D482ED4-236A-484B-9810-DFEE702A5541}.Release|Any CPU.ActiveCfg = Release|Any CPU -- Gitee From 2f4e32da99775833b90c531cfb32ff19bd4bab77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8D=E5=81=9A=E7=A0=81=E5=86=9C?= <599854767@qq.com> Date: Thu, 30 Jun 2022 20:07:56 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E8=8E=B7=E5=8F=96=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Come.AspNetCore.Sample/AuthRequestFactory.cs | 2 +- Come.AspNetCore.Sample/Startup.cs | 3 +++ Come.AspNetCore.Sample/appsettings.json | 4 +-- Come.CollectiveOAuth/Utils/AppSettingUtils.cs | 26 +++++++++++++++---- 4 files changed, 27 insertions(+), 8 deletions(-) diff --git a/Come.AspNetCore.Sample/AuthRequestFactory.cs b/Come.AspNetCore.Sample/AuthRequestFactory.cs index 5d9a404..36068cb 100644 --- a/Come.AspNetCore.Sample/AuthRequestFactory.cs +++ b/Come.AspNetCore.Sample/AuthRequestFactory.cs @@ -20,7 +20,7 @@ namespace Come.AspNetCore.Sample { if (_clientConfigs == null) { - var _defaultPrefix = "CollectiveOAuth_"; + var _defaultPrefix = "OAuthConfig:CollectiveOAuth_"; _clientConfigs = new Dictionary(); #region 或者默认授权列表数据 diff --git a/Come.AspNetCore.Sample/Startup.cs b/Come.AspNetCore.Sample/Startup.cs index 17874cc..a741c4b 100644 --- a/Come.AspNetCore.Sample/Startup.cs +++ b/Come.AspNetCore.Sample/Startup.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Come.CollectiveOAuth.Utils; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; @@ -23,6 +24,8 @@ namespace Come.AspNetCore.Sample public void ConfigureServices(IServiceCollection services) { services.AddControllersWithViews(); + + services.AddSingleton(new AppSettingUtils(Configuration)); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. diff --git a/Come.AspNetCore.Sample/appsettings.json b/Come.AspNetCore.Sample/appsettings.json index 64de1c7..0dc7ffc 100644 --- a/Come.AspNetCore.Sample/appsettings.json +++ b/Come.AspNetCore.Sample/appsettings.json @@ -1,6 +1,6 @@ { - "AppSettings": { - /*΢ҵɨ*/ + "OAuthConfig": { + /*wechat*/ "CollectiveOAuth_WECHAT_ENTERPRISE_SCAN_ClientId": "xxxxxxxxxxxxxxxxx", "CollectiveOAuth_WECHAT_ENTERPRISE_SCAN_AgentId": "xxxxxx", "CollectiveOAuth_WECHAT_ENTERPRISE_SCAN_ClientSecret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", diff --git a/Come.CollectiveOAuth/Utils/AppSettingUtils.cs b/Come.CollectiveOAuth/Utils/AppSettingUtils.cs index cf0b083..fe7dd3b 100644 --- a/Come.CollectiveOAuth/Utils/AppSettingUtils.cs +++ b/Come.CollectiveOAuth/Utils/AppSettingUtils.cs @@ -1,8 +1,16 @@  +using Microsoft.Extensions.Configuration; + namespace Come.CollectiveOAuth.Utils { public class AppSettingUtils { + static IConfiguration Configuration { get; set; } + + public AppSettingUtils(IConfiguration configuration) + { + Configuration = configuration; + } /// /// 根据Key取Value值 /// @@ -10,16 +18,24 @@ namespace Come.CollectiveOAuth.Utils public static string GetStrValue(string key) { var value = ""; -#if NET45 - value = System.Configuration.ConfigurationManager.AppSettings[key]; -#else - value = Come.CollectiveOAuth.Utils.ConfigurationManager.AppSettings[key]; -#endif + + value = GetConfig(key); + if (!string.IsNullOrWhiteSpace(value)) { return value.ToString().Trim(); } return value; } + + /// + /// 获取配置文件 + /// + /// eg: WeChat:Token + /// + public static string GetConfig(string key) + { + return Configuration[key]; + } } } \ No newline at end of file -- Gitee