title: ASP.NET Core JWT mapping role claims to ClaimsIdentity
body: <p>I want to protect ASP.NET Core Web API using JWT. Additionally, I would like to have an option of using roles from tokens payload directly in controller actions attributes.</p>
  
  <p>Now, while I did find it out how to use it with Policies:</p>
  
  <pre><code>Authorize(Policy="CheckIfUserIsOfRoleX")
  ControllerAction()...
  </code></pre>
  
  <p>I would like better to have an option to use something usual like:</p>
  
  <pre><code>Authorize(Role="RoleX")
  </code></pre>
  
  <p>where Role would be automatically mapped from JWT payload.</p>
  
  <pre><code>{
      name: "somename",
      roles: ["RoleX", "RoleY", "RoleZ"]
  }
  </code></pre>
  
  <p>So, what is the easiest way to accomplish this in ASP.NET Core? Is there a way to get this working automatically through some settings/mappings (if so, where to set it?) or should I, after token is validated, intercept generation of <code>ClaimsIdentity</code> and add roles claims manually (if so, where/how to do that?)?</p>