简体   繁体   中英

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. 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.

You could refer to Scaffold identity into an MVC project without existing authorization to add Identity.

Remember to add migrations and call app.UseAuthentication() from your Configure . 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..

public class ApplicationDbContext : IdentityDbContext<IdentityUser>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM