首页 > 编程语言 >asp.netcore Authentication signOut

asp.netcore Authentication signOut

时间:2023-01-05 18:00:36浏览次数:67  
标签:SignOutAsync just netcore signOut Authentication asp logout httpContext

.net 项目下面的写法会 logout:

    public class LogoutController : ControllerBase
    {
        public IActionResult Index()
        {
            return SignOut("Cookies", "OpenIdConnect");
        }
    }

   app.MapGet("/logout", (HttpContext cxt) => {
               return Results.SignOut(null, new[] { "Cookies", "OpenIdConnect" } );
   });

 the effects are same!

For the first snap, is just a static method.   new SignOutResult(authenticationSchemes);

the object finally call    httpContext.SignOutAsync(AuthenticationSchemes[i], Properties);

how httpContext logout?  SignOutAsync is just a extensive method which get the IAuthenticationService and logout.

we can also call GetTokenAsync() to get access_token or id_token,when we use OIDC

 

标签:SignOutAsync,just,netcore,signOut,Authentication,asp,logout,httpContext
From: https://www.cnblogs.com/qgbo/p/17028492.html

相关文章