3

I have existing project with a SQL Server database, EF with database first, unit of work and service layer. I need to add ASP.NET MVC project and use existing service to authenticate user.

I found different complicated decisions. I need to use my service in identity or implement authentication without identity.

1
  • Did you end up using the Identity? Commented Nov 30, 2016 at 23:22

2 Answers 2

3

ASP.NET Identity contains full stack of features for implementation authentication.

Details and instructions there: http://www.asp.net/identity/overview/getting-started/introduction-to-aspnet-identity

In my opinion you should to use Identity instead of own implementation because ASP.NET Identity fully tested, stable and has reach implementation also very flexible in development.. Also there are a huge community that can help you in your questions about ASP.NET Identity.

Sign up to request clarification or add additional context in comments.

2 Comments

For current project I need only simply login. I don't need all identity infrastructure. There is one problem with identity it broke my application separation. It need DbContext directly, currently project use unit of work, repositories and services as layers.
The problem with Identity is its tightly coupled with Entity Framework (which many people don't use). It may also be overkill for many use cases.
2

Please try this package on Nuget (AuthPackage) its enables you to add authentication to your asp.net mvc easily.

  1. install package using Package Manager Console:

     Install-Package AuthPackage
    
  2. add Connection String to your Web.config in (appSettings):

     <add key="connectionString" value="connectionStringHere" />
    
  3. you're ready to register users, login, logout

example:

 public async Task<ActionResult> SignIn()
    {
        var context = System.Web.HttpContext.Current;
        AuthUser authUser = new AuthUser(context);
        await authUser.SignIn("[email protected]", "123456");
        return RedirectToAction("Index", "Home");
    }

You can read the Documentation here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.