简体   繁体   English

在Asp.Net Core(MVC)的现有项目中将身份验证从无身份验证更改为个人身份验证

[英]Change authentication from no authentication to individual authentication in existing project of Asp.Net Core (MVC)

I am working with asp.net core mvc application in which, when I have created project at that time I have choosen no authentication as authentication type. 我正在使用asp.net核心mvc应用程序,当我在那时创建项目时,我没有选择身份验证作为身份验证类型。 but now I need to use individual authentication for standard functionalities like register, login, forgot password, email verification and all. 但现在我需要对标准功能使用个人身份验证,如注册,登录,忘记密码,电子邮件验证等等。

problem is I have completed half of development and can't start now from beginning. 问题是我已经完成了一半的开发,现在无法从头开始。 so need to change authentication type in my existing project. 所以需要在我现有的项目中更改身份验证类型。

is there any way to update authentication in existing .net core application. 有没有办法在现有的.net核心应用程序中更新身份验证。

You could refer to Scaffold identity into an MVC project without existing authorization to add Identity. 您可以将Scaffold身份引用到MVC项目中,而无需添加身份的现有授权

Remember to add migrations and call app.UseAuthentication() from your Configure . 请记住添加迁移并从Configure调用app.UseAuthentication() method. 方法。

If you have your dbContext already, modify it to inherit IdentityDbContext<IdentityUser> and choose it when you do scaffolding instead of creating a new Data context class.. 如果已经有dbContext,请修改它以继承IdentityDbContext<IdentityUser> ,并在进行脚手架而不是创建新的数据上下文类时选择它。

public class ApplicationDbContext : IdentityDbContext<IdentityUser>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ASP .NET CORE 5 更改现有项目的身份验证 - ASP .NET CORE 5 Changing authentication for an existing project 在asp.net Core MVC中更改Facebook身份验证按钮的布局 - Change layout of Facebook authentication button in asp.net Core MVC .Net Core 3.1 MVC 身份验证个人用户帐户和 ASP.NET 核心项目中的脚手架身份 - .Net Core 3.1 MVC Authentication Individual User Accounts and Scaffold Identity in ASP.NET Core projects 从 ASP.NET 核心 MVC 上的 JWT 身份验证中检索声明 - Retrieve claims from JWT authentication on ASP.NET Core MVC 个人用户帐户在ASP.Net MVC中不进行身份验证 - Individual User Accounts to No Authentication in ASP.Net MVC ASP.Net MVC-OWIN-允许Windows /个人身份验证 - ASP.Net MVC - OWIN - Allowing Windows/Individual Authentication ASP.Net Core 2身份验证 - ASP.Net Core 2 authentication ASP.Net Core 5 中的身份验证 - Authentication in ASP.Net Core 5 ASP.NET MVC中的身份验证 - Authentication in ASP.NET MVC 此外,密码保护作为 Azure WebApp 托管的 ASP.NET Core MVC 网站和现有身份验证 - Additionally password protect an ASP.NET Core MVC website hosted as Azure WebApp with existing authentication
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM