[英]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.