title: Accessing RouteData in Blazor Client Side AuthorizationHandler
body: <p>I am currently learning about Blazor Client Side (WebAssembly) and while looking at Authorization I was trying to validate that a user has access to a path in the URI.</p>
  
  <p>Given a URI like <a href="http://localhost:1234/" rel="nofollow noreferrer">http://localhost:1234/</a>{route}/resource</p>
  
  <p>On a page I can map route to a property but how can I get access to this value within an AuthorizationHandler to validate that the JWT has a claim with this value?</p>
  
  <p>I have tried to inject RouteData and I have tried to access the HttpContext via IHttpContextAccessor but that is null.</p>
  
  <p>This is the class I am trying to get working</p>
  
  <pre><code>public class RouteDataAccessor : IRouteDataAccessor
  {
      private readonly RouteData _routeData;
      public RouteDataAccessor(IHttpContextAccessor httpContextAccessor)
      {
          httpContextAccessor.NullCheck(nameof(httpContextAccessor));
          httpContextAccessor.HttpContext.NullCheck(nameof(httpContextAccessor.HttpContext));
  
          _routeData = httpContextAccessor.HttpContext.GetRouteData();
      }
  
      public bool TryGetData(string key, out string value)
      {
          value = null;
          if (_routeData == null || !_routeData.Values.TryGetValue(key, out value))
          {
              return false;
          }
  
          return true;
      }
  }
  </code></pre>