具有 ASP.NET 核心 2.2 的身份服务器 4

Identity Server 4 with ASP.NET Core 2.2

通过参考 ASP.NET Identity 和 EF 快速入门示例,我在 Identity Server 4 和 ASP.NET Core 2.0 上取得了巨大的成功,并且已经 运行 在生产中成功地使用了它们。

对于我正在进行的一个新项目,我尝试使用 ASP.NET Core 2.2,我注意到所有 ASP.NET 身份相关的页面现在都集成到一个 Razor 库中可以搭建脚手架,以便进行自定义。

我的问题是:我们是否仍继续使用旧的 ASP.NET Core 2.0 与 ASP.NET Identity 和 Identity Server 集成?或者是否有一些将快速入门代码移植到新的 Razor Pages 编码范例中的示例?

谢谢!

如果您要从以前的版本升级,我建议您阅读以下内容:

https://docs.microsoft.com/en-us/dotnet/core/whats-new/dotnet-core-2-2

然后您可以评估您是否希望通过迁移 IDS 应用程序来实现一些新功能。

Or are there some examples of porting the quick start code over into the new Razor Pages paradigm of coding?

您可以追踪这个 github 问题:Update Quickstarts。如果您使用的是 .net core 2.2/IdentityServer 2.3 ,则应在 Quickstarts 文档中修改一些更改。例如,默认用户是 IdentityUser。

如果您在尝试使用它时遇到任何问题,您可以在 link 中发送反馈并跟踪。

不要使用

    app.UseAuthentication();

改为使用Quickstart.UI

    PowerShell -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/IdentityServer/IdentityServer4.Quickstart.UI/master/getmaster.ps1'))"

这里是一个工作演示

步骤 01

我们将开一个运行window

在键盘上按下

Windoes Key + R

稍等

步骤 02

我们将打开一个cmd Window

在 运行 window 文本输入上写入

cmd

在键盘上按下

Enter

步骤 03

确保 App1/appsettings.json 有这个连接字符串,默认情况下它会在那里,如果没有添加它

DataSource=app.db

步骤 04

我们将创建一个目录并将其作为我们 cmd 的工作目录

在CMD上Window写入

mkdir D:\Projects\P.IT.Support\asp.net

cd /d D:\Projects\P.IT.Support\asp.net

步骤 05

我们将下载并运行脚本

在CMD上Window写入

set scriptUrl="https://gist.githubusercontent.com/Elrashid/133d308902b453c280725379dda02684/raw/Flow4-AspIdentity-Sqlite-RequireConsent-Two-App-For-API-And-Web.bat"

PowerShell -Command "(new-object System.Net.WebClient).DownloadFile('%scriptUrl%','Flow4-AspIdentity-Sqlite-RequireConsent-Two-App-For-API-And-Web.bat')"

Flow4-AspIdentity-Sqlite-RequireConsent-Two-App-For-API-And-Web.bat