如何获取 UseOpenIdConnectAuthentication 设置的 Owin AuthenticationType?

问题描述 投票:0回答:1

我可以通过枚举User.Identities读取调用UseCookieAuthentication时设置的AuthenticationType,但它不包括我使用UseOpenIdConnectAuthentication设置的AuthenticationType。 我需要两者都可以使用 SignOut 成功注销。 如何获取我在 UseOpenIdConnectAuthentication 中设置的 AuthenticationType?

asp.net .net owin
1个回答
0
投票

我终于在另一篇文章中找到了答案。

https://stackoverflow.com/a/38567468/4194514

Request.GetOwinContext()
       .Authentication
       .SignOut(HttpContext.GetOwinContext()
                           .Authentication.GetAuthenticationTypes()
                           .Select(o => o.AuthenticationType).ToArray());
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.