2017-09-25 63 views
0
[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

回答