How to use ASP.net Core 1 "SignInManager" without EntityFramework

asp.net asp.net-mvc c# entity-framework

Question

Without the EntityFramework, I want to build ASP.NET authentication using the SignInManager. I've used SQLClient to build my own database layer, and I only want to perform the calls required for ASP.net authentication to function.

I have the following code, which is run from Startup.cs:

// Add EF services to the services container.
services.AddEntityFramework()
    .AddSqlServer()
    .AddDbContext<OAuthAppDbContext>(opt => opt.UseSqlServer(Configuration["Data:DefaultConnection:ConnectionString"]));

// Add Identity services to the services container.
services.AddIdentity<ApplicationUser, ApplicationRole>(options =>
{
    options.Cookies.ApplicationCookieAuthenticationScheme = "ApplicationCookie";
    options.Cookies.ApplicationCookie.AuthenticationScheme = "ApplicationCookie";
    options.Cookies.ApplicationCookie.CookieName = "oAuthInterop";
    options.Cookies.ApplicationCookie.AutomaticChallenge = true;
    options.Cookies.ApplicationCookie.AutomaticAuthenticate = true;
    options.Cookies.ApplicationCookie.DataProtectionProvider = new DataProtectionProvider(new DirectoryInfo("d:\\development\\artefacts"),
        configure =>
        {
            configure.SetApplicationName("TestAuthApp");
            //configure.ProtectKeysWithCertificate("thumbprint");
        });
})
    .AddEntityFrameworkStores<OAuthAppDbContext, int>()
    .AddDefaultTokenProviders();

and I must stop relying on Entity Framework (and call my own db methods for gathering user details). Has anyone else used ASP.net core to do a similar task?

Thank you in advance for any advice.

1
23
4/22/2016 12:47:55 PM

Accepted Answer

ZZZ_tmp
42
6/18/2019 9:22:29 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow