asp.netcore Authentication signOut
2023-01-05 17:54 qgbo 阅读(23) 评论(0) 编辑 收藏 举报.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
气功波(18037675651)