title: User.Identity.Name is empty in Asp.NET Core 2.0 API Controller
body: <p>I am new to ASP.NET core itself. However, I am creating WebAPIs in ASP.NET Core 2.0.  I have configured JWT Bearer Token based authentication. Below is my Controller which return token.</p>
  
  <pre><code>    [AllowAnonymous]
  [Route("api/[controller]")]
  public class TokenController : Controller
  {
      private readonly UserManager&lt;UserEntity&gt; userManager;
      private readonly SignInManager&lt;UserEntity&gt; signInManager;
  
      public TokenController(UserManager&lt;UserEntity&gt; userManager, SignInManager&lt;UserEntity&gt; signInManager)
      {
          this.userManager = userManager;
          this.signInManager = signInManager;
      }
  
      // GET: api/values
      [HttpGet]
      public async Task&lt;IActionResult&gt; Get(string username, string password, string grant_type)
      {
          {
              var user = await userManager.FindByEmailAsync(username);
  
              if (user != null)
              {
                  var result =await signInManager.CheckPasswordSignInAsync(user, password, false);
                  if (result.Succeeded)
                  {
  
                      var claims = new[]
                      {
                          new Claim( JwtRegisteredClaimNames.Sub, username),
                          new Claim( JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString()),
                          new Claim( JwtRegisteredClaimNames.GivenName, "SomeUserID")
                      };
  
                      var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes("secretesecretesecretesecretesecretesecrete"));
                      var creds = new SigningCredentials(key, SecurityAlgorithms.HmacSha256);
  
                      var token = new JwtSecurityToken( issuer: "test",
                                                       audience: "test",
                                                       claims: claims,
                                                        expires: DateTime.Now.AddDays(15),
                                                        signingCredentials: creds);
  
                      return Ok(new { access_token = new JwtSecurityTokenHandler().WriteToken(token), expires_on=DateTime.Now.AddDays(15) });
  
                  }
              }
          }
  
          return BadRequest("Could not create token");
      }
  
  
  }
  </code></pre>
  
  <p>But when calling ValuesController API which is decorated with <strong>[Authorize]</strong> attributes. I am getting  <strong>User.Identity.Name</strong> is empty.  I am not getting any information about user.  I am not sure, My token controller is correctly written.  As long as it is protecting my ValuesController, I assume, it is correct.  However, I might be missing something.  Please help.</p>
  
  <blockquote>
    <p>Note: I am developing using Visual Studio 2017 with Mac Community
    addition</p>
  </blockquote>