ASP.NET 5 Identity – custom SignInManager

I had problems too trying to use a custom SignInManager and turns out to be really easy after all to implement.

In Startup.cs, after the default implementation of services.Identity

services.AddIdentity<ApplicationUser, IdentityRole>()
    .AddEntityFrameworkStores<ApplicationDbContext>()
    .AddDefaultTokenProviders();

You only need to inject into the built-in DI the following:

services.AddScoped<SignInManager<MyApplicationUser>, MySignInManager>();

The default SignInManager is overwrited by the custom one.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)