Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding Identity to an existing project

I've got an MVC project, and I want to add Identity to it, but I can't seem to find any good articles on how to do so.

Is there an easy way to add Identity to an existing project?

I already have a database with stuff in it

like image 315
Zach Johanson Avatar asked Feb 19 '15 21:02

Zach Johanson


People also ask

How do I add Owin to an existing project?

In Solution Explorer, right-click your project, select Add, and then Add New Item. In the search text box dialog, type "owin". Name the class "Startup" and select Add.

How do I change the authentication After creating a project?

To configure the authentication manually, open Visual Studio project properties >> go to Debug tab. It has the option to configure the same. Alternatively, we can also configure Windows Authentication related properties into launchSettings. json file.

What is IdentityDbContext?

IdentityDbContext() Initializes a new instance of the IdentityDbContext class. IdentityDbContext(DbContextOptions) Initializes a new instance of IdentityDbContext.

Do I need IdentityServer4?

Why do we need IdentityServer4? ASP.NET Identity can receive a security token from a third-party login provider like Facebook, Google, Microsoft and Twitter. But If you want to issue a security token for a local ASP.NET Identity user you need to work with a third-party library like IdentityServer4, OpenIddict.

What is Microsoft ASP.NET Core identity UI?

ASP.NET Core Identity UI is the default Razor Pages built-in UI for the ASP.NET Core Identity framework. This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/bb01bbf4433e27289b99001b7de6a582879d1835. Product. Versions. .NET.

What is scaffolding in .NET Core?

Scaffolding in ASP.NET Core is a technique used to generate code at design time to support a number of common application scenarios when working with Entity Framework Core. The code generation tool is available as a Nuget package.


1 Answers

Well, in one respect, you simply have to add the Nuget package and start writing code with it, but I think you're probably talking about all the extras: the pre-written code and samples for doing things like password resets, two-factor auth, etc.

For that, no, there's not really an easy way, at least in the sense of click a button and go. What I would recommend is creating a new MVC 5 project with Individual Auth, and then adding the Identity Samples Nuget package to it. Then, open your existing project in another Visual Studio window and copy/paste or use the sample code as a guide for writing your own.

like image 179
Chris Pratt Avatar answered Oct 05 '22 23:10

Chris Pratt