ASP.NET 具有应用程序内商店个人用户帐户的核心 WebAPI 项目 Visual Studio 2019
ASP.NET Core WebAPI project with in-app store Individual User Accounts Visual Studio 2019
我试图在 visual studio 中创建一个项目,我在 selecting WebApi 项目后选择了个人用户帐户选项,现在在 VS 2019 中它似乎与以前有很大不同,现在需要一些参数,有人可以给我一些如何配置的例子吗?
它正在询问:
Domain Name
Application ID
Sign-up or Sign-in Policy
默认情况下它是 selected 就像 select 的唯一选项:
Connect to an existing user store in the cloud
那是因为您选择了 API 项目模板并试图在该模板上设置 Individual User Accounts
模式,但是 WebAPI 模板没有 Store user account in-app
功能。
如果您正在使用 MVC 项目并尝试将身份验证模式设置为个人用户帐户,您将看到 Store user accounts in-app
选项。
此外,您可以尝试使用 this answer 中所述的命令在控制台中启动项目:
dotnet new webapi -au Individual
You can open your project in VS after that. (to work around the
dialog). Then you can use for example the authorize-attribute. But the
project is still configured to use Azure Bearer Authentication. You
have to decide where to get identity from. You can take
identityserver4 or build your own "Custom storage providers for
ASP.NET Core Identity" (MS-Docs)
This is because in MVC projects you have an account controller with
views to handle registrations and get a username and password and so
forth, but there's no such a thing in WebAPI and you have to use other
authentication mechanisms like JWT.
在 AspNetCore 的 Github 中有关于此功能的 discussion。
我试图在 visual studio 中创建一个项目,我在 selecting WebApi 项目后选择了个人用户帐户选项,现在在 VS 2019 中它似乎与以前有很大不同,现在需要一些参数,有人可以给我一些如何配置的例子吗?
它正在询问:
Domain Name
Application ID
Sign-up or Sign-in Policy
默认情况下它是 selected 就像 select 的唯一选项:
Connect to an existing user store in the cloud
那是因为您选择了 API 项目模板并试图在该模板上设置 Individual User Accounts
模式,但是 WebAPI 模板没有 Store user account in-app
功能。
如果您正在使用 MVC 项目并尝试将身份验证模式设置为个人用户帐户,您将看到 Store user accounts in-app
选项。
此外,您可以尝试使用 this answer 中所述的命令在控制台中启动项目:
dotnet new webapi -au Individual
You can open your project in VS after that. (to work around the dialog). Then you can use for example the authorize-attribute. But the project is still configured to use Azure Bearer Authentication. You have to decide where to get identity from. You can take identityserver4 or build your own "Custom storage providers for ASP.NET Core Identity" (MS-Docs)
This is because in MVC projects you have an account controller with views to handle registrations and get a username and password and so forth, but there's no such a thing in WebAPI and you have to use other authentication mechanisms like JWT.
在 AspNetCore 的 Github 中有关于此功能的 discussion。