Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Cookie Middleware without Core Identity

$
0
0

I'm following the directions in this article:  https://docs.asp.net/en/latest/security/authentication/cookie.html

I
get "No authentication handler is configured to handle the scheme MyCookieMiddlewareInstance.


Startup.cs :


   app.UseCookieAuthentication( new CookieAuthenticationOptions( )
   {
    AuthenticationScheme = "MyCookieMiddlewareInstance",
    LoginPath = new PathString( "/Account/Signin/" ),
    AccessDeniedPath = new PathString( "/Account/Forbidden/" ),
    AutomaticAuthenticate = true,
    AutomaticChallenge = true
   } );

.

AccountController.cs :

   var identity = new ClaimsIdentity( claims );

   var claimsPrincipal = new ClaimsPrincipal( identity );

   var authenticationProperties = new AuthenticationProperties( )
   {
    IsPersistent = true
   };

   await _httpContext.Authentication.SignInAsync( "MyCookieMiddlewareInstance", claimsPrincipal, authenticationProperties );


Any ideas?

 


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>