title: Set up JWT Policies with Claims in .NET Core 3.1?
body: <p>I am trying to set up my project with authorization middle ware using <code>JWT</code>. </p>
  
  <p>Here is a scenario for example </p>
  
  <p>I have 3 modules </p>
  
  <ol>
  <li><p>Analytics </p>
  
  <ul>
  <li>Search </li>
  <li>View</li>
  <li>Save </li>
  </ul></li>
  <li><p>Search</p>
  
  <ul>
  <li>Search </li>
  <li>View</li>
  <li>Save</li>
  </ul></li>
  <li><p>Admin </p>
  
  <ul>
  <li>Only admins </li>
  </ul></li>
  </ol>
  
  <hr>
  
  <p>From my understanding based on multiple blogs I have to set up middle ware With <code>Policy</code> that will represent my functionality <code>Analytics</code>, <code>Search</code>, <code>Admin</code>. Then I decorate Controller with <code>[Authorize(Policy="Analytics")]</code> and JWT will authorize against that <code>Analytics</code> Policy. </p>
  
  <p>Question:</p>
  
  <p>If My policy has multiple functions like <code>Search = 1</code>, <code>View = 2</code>, <code>Save = 3</code>, where <code>Save</code> has access to both <code>View</code> and <code>Search</code> how do I configure claim for that policy and pass information into <code>Authorize</code> attribute?</p>
  
  <pre><code> services.AddAuthorization((options) =&gt;
              {
                  options.AddPolicy("Analytics", policy =&gt;
                  {
                      policy.AuthenticationSchemes.Add(JwtBearerDefaults.AuthenticationScheme);
                      ???
                      ???
                      ???
                  });
              });
  
  </code></pre>
  
  <pre><code>[Authorize(Policy = "Analytics")]
  </code></pre>