带有应用程序内商店的ASP.NET Core WebAPI项目个人用户帐户Visual Studio 2019 [英] ASP.NET Core WebAPI project with in-app store Individual User Accounts Visual Studio 2019
问题描述
我试图在Visual Studio中创建一个项目,我在选择WebApi项目后选择了个人用户帐户选项,现在在VS 2019中似乎与以前大不相同,现在需要一些参数,任何人都可以给我一些如何配置它的示例?
正在询问:
Domain Name
Application ID
Sign-up or Sign-in Policy
默认情况下,它是唯一选择的选项:
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
选项.
此外,您可以尝试使用控制台中的命令来启动项目,如此答案中所述:>
dotnet new webapi -au Individual
之后,您可以在VS中打开您的项目. (围绕 对话).然后,您可以使用例如authorize-attribute.但是 项目仍配置为使用Azure承载身份验证.你 必须决定从哪里获得身份.你可以采取 identityserver4或构建自己的自定义存储提供商" ASP.NET核心标识"( MS文档)
这是因为在MVC项目中,您有一个帐户控制者, 视图以处理注册并获取用户名和密码等 第四,但是WebAPI中没有这样的东西,您必须使用其他 JWT之类的身份验证机制.
AspNetCore的Github中对此功能进行了讨论.
I was trying to create a project in visual studio, I chose the option Individual User Account after selecting WebApi project, and now in VS 2019 it seems to be pretty different than before, now some parameters are requested, can anybody give me some examples of how to configure it?
It is asking about:
Domain Name
Application ID
Sign-up or Sign-in Policy
And by default it is selected like the only option to select:
Connect to an existing user store in the cloud
That's because you are selected API project template and trying to set Individual User Accounts
mode on that but WebAPI templates don't have the Store user account in-app
feature.
If you're using MVC project and try to set the Authentication mode to Individual User Accounts you'll see the Store user accounts in-app
option.
Also, you can try to start your project in the console with this command as said in 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.
There's a discussion about this feature in AspNetCore's Github.
这篇关于带有应用程序内商店的ASP.NET Core WebAPI项目个人用户帐户Visual Studio 2019的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!