Reputation: 129
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.
Upvotes: 3
Views: 4316
Reputation: 31
Please try this package on Nuget (AuthPackage) its enables you to add authentication to your asp.net mvc easily.
install package using Package Manager Console:
Install-Package AuthPackage
add Connection String to your Web.config in (appSettings):
<add key="connectionString" value="connectionStringHere" />
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
Upvotes: 2
Reputation: 1446
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.
Upvotes: 3