title: No User Identity Being Created From JWT Token
body: <p>I have a .Net Core 2 Web API project that is using JwtBearer Authentication.  However, while this works in regards to Authenticating my user and respecting the <code>[Authorize]</code> attribute on my controller, the User Identity and Claims are never populated.  Is there something more I have to do to create ensure that a ClaimsIdentity is created for my authenticated user?</p>
  
  <p><strong>Startup.cs</strong></p>
  
  <pre><code>public void ConfigureServices(IServiceCollection services)
  {
     ...
     services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
        .AddJwtBearer(options =&gt; 
        {
            options.Authority = "https://myTenant.auth0.com";
            options.Audience = "https://localhost:5001/api/v1";
            options.RequireHttpsMetadata = false;
  
            options.TokenValidationParameters = new TokenValidationParameters
            {
               ValidateIssuer = true,
               ValidateAudience = true,
               ValidateLifetime = true,
               ValidateIssuerSigningKey = true,
               ValidIssuer = "myTenant.auth0.com",
               ValidAudience = "https://localhost:5001/api/v1"
            };
       });
  }
  
  public void Configure(IApplicationBuilder app, IHostingEnvironment env, SystemModelBuilder modelBuilder)
  {
     ...
     app.UseHttpsRedirection();
     app.UseAuthentication();
  }
  </code></pre>
  
  <p>My token looks like this on jwt.ms: </p>
  
  <pre><code>{
    "typ": "JWT",
    "alg": "RS256",
    "kid": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
  }
  .{
    "profileData": {
       "given_name": "Rodd",
       "family_name": "Harris"
    },
    "iss": "https://myTenant.auth0.com/",
    "sub": "auth0|37b5f5c54fdac",
    "aud": [
       "https://localhost:5050/api/v1/",
       "https://myTenant.auth0.com/userinfo"
    ],
    "iat": 1532628090,
    "exp": 1532629290,
    "azp": "2RdsNtKpUgh_wgB3NI6gxd-OAl",
    "scope": "openid profile email app.client.read"
  }.[Signature]
  </code></pre>
  
  <p>In my controller, I have something like this:</p>
  
  <pre><code>[ApiController]
  [Route("api/v1/[controller]")]
  [Authorize]
  public class TestController : ControllerBase
  {
      [HttpGet("clients")]
      public async Task&lt;IActionResult&gt; ClientsList()
      {
         //Debugger gets here -- user is authenticated           
         var user = HttpContext.User.Identity.Name; //Always null
         var count = HttpContext.User.Claims.Count(); //Always 0
         var allowed = HttpContext.User.IsAuthenticated;  //Always true
         var type = HttpContext.User.AuthenticationType; //AuthenticationTypes.Federated
         ...
      }
  </code></pre>
  
  <p>What keeps the user's name and claims from being created?</p>
  
  <p><strong>Update</strong></p>
  
  <p>So I just realized I AM actually getting the claims mapped into <code>HttpContext.User.Identity.Claims</code>.  Also realized that my token doesn't have a name value to automagically map to the Identity.  So, I guess my real question is, how do I override the custom mapping and do my own mapping of the token into an Identity?</p>