如何阅读从临时cookie外部身份在.NET核心2
问题描述:
[HttpGet("ExternalLoginCallback")]
public async Task<IActionResult> ExternalLoginCallback(string returnUrl)
{
// read external identity from the temporary cookie
var info = await HttpContext.Authentication.GetAuthenticateInfoAsync(IdentityServerConstants.ExternalCookieAuthenticationScheme);
var tempUser = info?.Principal;
if (tempUser == null)
{
throw new Exception("External authentication error");
}
// retrieve claims of the external user
var claims = tempUser.Claims.ToList();
这是外部登录回调的使用IdentityServer4片段。我已经迁移到.net core 1 to 2
,我收到了警告HttpContext.Authentication' is obsolete: 'This is obsolete and will be removed in a future version.
那么,在.net core 2中引入哪种方法来获取身份?如何阅读从临时cookie外部身份在.NET核心2
谢谢@leastprivilege! –
当我在迁移到.netcore 2.0后尝试Windows身份验证时。我得到这个异常“InvalidOperationException:没有认证处理程序配置为处理方案:协商”。我如何解决这个问题? –
它现在被称为'Windows'。 – leastprivilege