title: How to get the current ClaimsPrincipal in SignalR core outside of a Hub
body: <p>I have a SignalR Core hub which has a dependency on a service. That service itself has it's own dependencies and one of them requires access to the current ClaimsPrincipal.</p>
  
  <p>I know, that I can access the ClaimsPrincipal inside the hub using the Context.User property and pass it as a parameter to the service, which can also pass it as a parameter and so on. But I really don't like to pollute the service API by passing this kind of ambient info as a parameter.</p>
  
  <p>I've tried to use the IHttpContextAccessor as described in: <a href="https://docs.microsoft.com/en-us/aspnet/core/migration/claimsprincipal-current?view=aspnetcore-2.2" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/aspnet/core/migration/claimsprincipal-current?view=aspnetcore-2.2</a>
  This seems to be working with a simple SignalR setup, but it isn't working with the Azure SignalR service, which will be our production setup.</p>
  
  <p>Is there a reliable way how to get the ClaimsPrincipal outside of the hub that will work for both a simple local setup and Azure SignalR service?</p>