Using Asp.net mvc identity in multiple projects
NickName:AmirReza Ask DateTime:2016-01-16T04:16:21

Using Asp.net mvc identity in multiple projects

we have a project in multiple layer ( containing data access layer , service layer , web .... ) also we have some entity like Person , User , Customer , Employee now we are going to use asp.net identity in our website for user register and authentication now if we want to register a user in one of the layers ( not website ) how we can do it according to asp.net identity , and what about authentication ?

(my first idea is add a user to database and use PasswordHasher Class of Microsoft.AspNet.Identity to hash a password , is there a better way ? for example move asp.net identity into a new class library project or any other ways )

another thing :

i want to know how we can use another entities like Customer , Employee ... in this design ?

Copyright Notice:Content Author:「AmirReza」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/34819169/using-asp-net-mvc-identity-in-multiple-projects

Answers
Win 2016-01-15T20:58:06

\n If we want to register a user in one of the layers ( not website ) how\n we can do it according to asp.net identity\n\n\nYou do not want bring ASP.Net Identity into Business Logic Layer. It should be at Presentation Layer only. \n\n\n (my first idea is add a user to database and use PasswordHasher Class\n of Microsoft.AspNet.Identity to hash a password , is there a better\n way ? for example move asp.net identity into a new class library\n project or any other ways )\n\n\nFirst of all, if you want to use ASP.Net Identity, you do not want to change or modify its tables. \n\nEasiest way is let ASP.Net Identity create tables first. Then you create your tables such as Customer, Employee. If you need relationship to UserId, use AspNetUsers - Id column as Primary Key or Foreign Key in your tables. \n\nAdam Freeman has free chapter for ASP.Net Identity here.\n\nOther Thoughts\n\nIf you want to change a lot, you might just want to consider using just OwinContext and AuthenticationManager instead of entire Identity. ",


More about “Using Asp.net mvc identity in multiple projects” related questions

Single ASP.NET Identity for multiple projects

Is there any way to use the ASP.NET Identity mechanism over two different projects?? ie. I want to use a single authentication mechanism for a MVC project and a WebAPI project. Is it possible?

Show Detail

Multiple projects using ASP.NET MVC areas

How can I setup multiple projects using areas in asp.net mvc 2?

Show Detail

Using Asp.net mvc identity in multiple projects

we have a project in multiple layer ( containing data access layer , service layer , web .... ) also we have some entity like Person , User , Customer , Employee now we are going to use asp.net

Show Detail

Combine ASP.NET MVC and Web API projects using identity

I am new to ASP.NET and I have to create an ASP.NET MVC project using the identity framework for authentication and authorization, but the access to the database (SQL Server) must be done in an

Show Detail

ASP.NET MVC Identity vs ASP.Net core 2.1 Identity (Cross authentication between them)

I have two different projects one for a web application which is in Asp.Net MVC using EF code first and another for mobile application APIs which is in Asp.Net Core 2.1 using EF code first, both are

Show Detail

ASP.NET MVC multiple intranet projects

I have been working on ASP.NET MVC for a while and loving it so far. But I am hitting a wall now. I am working on a new intranet site, where I will have to host many projects, ranging from couple of

Show Detail

Multiple ASP.NET MVC projects that builds as single ASP.NET MVC Application

We want to split our large asp.net mvc web application into multiple Visual Studio projects so that each team can independently on their visual studio project. Desired structure is: ASP.NET MVC

Show Detail

Merging two ASP.NET MVC projects together which use ASP.NET Identity

We have two ASP.NET MVC projects which both use ASP.NET Identity, and we need to merge them into one single project. We've got a solution made which contains both projects, and they both use the same

Show Detail

Using ASP.NET Identity when ASP.NET Core Web API and MVC projects are separate. Which should handle the auth?

If I were to create two separate projects: ASP.NET Core Web API project ASP.NET Core MVC project The MVC project would use HttpClient to talk to the Web API. If this is the case and I wante...

Show Detail

ASP.NET MVC 5, Identity, Unity container solution architecture

Assume a web project by ASP.NET MVC 5 and OWIN/Identity membership. The IoC is done with Unity. Everything is within one project now. Question: Does it make any sense to separate MVC, Idenity and I...

Show Detail