title: Can't access Roles in JWT Token .NET Core
body: <p>I have an application made with .NET Core API, Keycloak and JWT Token. </p>
  
  <p>The older version of Keycloak that I've been using so far, when it created the JWT Token it wrote the roles here on payload:</p>
  
  <pre><code>{
      "user_roles": [
          "offline_access",
          "uma_authorization",
          "admin",
          "create-realm"
    ]
  }
  </code></pre>
  
  <p>But now after I updated it, it's writing the roles here on payload:</p>
  
  <pre><code>{
    "realm_access": {
      "roles": [
        "create-realm",
        "teacher",
        "offline_access",
        "admin",
        "uma_authorization"
      ]
    },
  }
  </code></pre>
  
  <p>And I need to know how to change this old code to the new one, to tell that don't look at <code>user_roles</code>, but do look at <code>realm_access</code> then to <code>roles</code>.</p>
  
  <pre><code>public void AddAuthorization(IServiceCollection services)
  {
      services.AddAuthorization(options =&gt;
      {
          options.AddPolicy("Administrator", policy =&gt; policy.RequireClaim("user_roles", "admin"));
          options.AddPolicy("Teacher", policy =&gt; policy.RequireClaim("user_roles", "teacher"));
          options.AddPolicy("Pupil", policy =&gt; policy.RequireClaim("user_roles", "pupil"));
          options.AddPolicy(
              "AdminOrTeacher",
              policyBuilder =&gt; policyBuilder.RequireAssertion(
                  context =&gt; context.User.HasClaim(claim =&gt;
                                 claim.Type == "user_roles" &amp;&amp; (claim.Value == "admin" || claim.Value == "teacher")
                            ))
          );
      });
  }
  </code></pre>