[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中引入哪种方法来获取身份?
答案 0 :(得分:0)