title: Is there a way to get all User Claims using Asp.Net Core 2.2?
body: <p>I'm migrating my application from Asp.Net MVC 5 to Asp.Net Core 2.2. How do I get the logged in User Claims in Asp.Net Core 2.2?</p>
  
  <p>Asp.Net MVC 5 code:</p>
  
  <pre><code>var identity = new ClaimsPrincipal(User).Claims; //returns 141 claims
  </code></pre>
  
  <p>Asp.Net Core 2.2 code:</p>
  
  <pre><code>var identity = User.Claims.ToArray(); //returns 75 claims for same user id
  </code></pre>
  
  <p>I expect Asp.Net Core 2.2 application to return 141 claims but the actual claims returned are 75.</p>
  
  <p>----------------Startup.cs File-----------------</p>
  
  <pre><code>public class Startup
  {
      public Startup(IConfiguration configuration)
      {
          Configuration = configuration;
      }
  
      public IConfiguration Configuration { get; }
  
      // This method gets called by the runtime. Use this method to add services to the container.
      public void ConfigureServices(IServiceCollection services)
      {
          //CSRF
          services.AddAntiforgery(options =&gt; options.HeaderName = "X-XSRF-TOKEN");
  
          //Below methods are default methods that came with Core template.
          services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
  
          // In production, the Angular files will be served from this directory
          services.AddSpaStaticFiles(configuration =&gt;
          {
              configuration.RootPath = "ClientApp/dist";
          });
      }
  
      // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
      public void Configure(IApplicationBuilder app, IHostingEnvironment env, IAntiforgery antiforgery)
      {
          if (env.IsDevelopment())
          {
              app.UseDeveloperExceptionPage();
          }
          else
          {
              app.UseExceptionHandler("/Error");
              // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
              app.UseHsts();
          }
  
          app.UseHttpsRedirection();
  
          app.Use(async (context, next) =&gt;
          {
              string path = context.Request.Path.Value;
              if (path != null &amp;&amp; !path.ToLower().Contains("/api"))
              {
                  // XSRF-TOKEN used by angular in the $http if provided
                  var tokens = antiforgery.GetAndStoreTokens(context);
                  context.Response.Cookies.Append("XSRF-TOKEN",
                    tokens.RequestToken, new CookieOptions
                    {
                        HttpOnly = false,
                        Secure = true
                    }
                  );
              }
              await next();
          });
  
  
          app.UseSpaStaticFiles();
  
          app.UseMvc(routes =&gt;
          {
              routes.MapRoute(
                  name: "default",
                  template: "{controller}/{action=Index}/{id?}");
          });
  
          app.UseSpa(spa =&gt;
          {
              // To learn more about options for serving an Angular SPA from ASP.NET Core,
              // see https://go.microsoft.com/fwlink/?linkid=864501
  
              spa.Options.SourcePath = "ClientApp";
  
              if (env.IsDevelopment())
              {
                  spa.Options.StartupTimeout = new System.TimeSpan(0, 0, 160);
                  spa.UseAngularCliServer(npmScript: "start");
              }
          });
      }
  }
  </code></pre>