title: HubCallerContext User object empty
body: <p>I'm beginner with SignalR Hub and I've this problem.</p>
  <p>When &quot;OnConnectedAsync&quot; is called the object Context.User is always empty.</p>
  <p>This is the method:</p>
  <pre><code>[Authorize]
  public override async Task OnConnectedAsync()
  {
      if(Context.User.Identity.IsAuthenticated)
      {
          await base.OnConnectedAsync();
          Errore er = _g.AggiungiConnessione(Context.User.Identity.Name, Context);
      }
  }
  </code></pre>
  <p>the authentication is configurated like this:</p>
  <pre><code>services.AddAuthentication(options =&gt;
  {
      options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
      options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
  }).AddJwtBearer(options =&gt;
  {
      options.Events = new JwtBearerEvents
      {
          OnMessageReceived = context =&gt;
          {
              var path = context.HttpContext.Request.Path;
  
              if (!path.StartsWithSegments(&quot;/chatHub&quot;)) 
                  return Task.CompletedTask;
  
              var accessToken = context.Request.Headers[HeaderNames.Authorization];
              if (!string.IsNullOrWhiteSpace(accessToken) &amp;&amp; context.Scheme.Name == 
                  JwtBearerDefaults.AuthenticationScheme)
              {
                  context.Token = accessToken;
              }
  
              return Task.CompletedTask;
          }
      };
  });
  </code></pre>
  <p>the HubConnection is declared like this:</p>
  <pre><code>if (user.Identity.IsAuthenticated)
  {
      hubConnection = new 
   HubConnectionBuilder().WithAutomaticReconnect().WithUrl(navmanager.ToAbsoluteUri(&quot;/chatHub&quot;), 
      (opts) =&gt;
      {
          opts.HttpMessageHandlerFactory = (message) =&gt;
              {
                  if (message is HttpClientHandler clientHandler)
                  {
                      clientHandler.ServerCertificateCustomValidationCallback += (sender, 
                      certificate, chain, sslPolicyErrors) =&gt; { return true; };
                  }
                  return message;
               };
               opts.AccessTokenProvider = async () =&gt; await Task.FromResult(user.Identity.Name);
       }
  }
  </code></pre>
  <p>any suggestions?</p>