Dotnettency icon indicating copy to clipboard operation
Dotnettency copied to clipboard

Blazor support - cascading TenantInfo parameter

Open dazinator opened this issue 5 years ago • 1 comments

See cascading parameter concept in Blazor : https://github.com/dotnet-presentations/blazor-workshop/blob/master/docs/05-authentication-and-authorization.md

Dotnettency could offer a similar cascading parameter to allow access to the current TTenant information retrieved from the server.

dazinator avatar May 16 '19 20:05 dazinator

Support for this could be added to a Donettency.Spa.Blazor package. Similar to CascadingAuthenticationState component, you could use CascadingTenantState component. This component would be configured in startup.cs to obtain current tenant information (generic TTenantInfo) from either:

  1. GET request to some configurable path that returns TTenantInfo as Json.
  2. Http client RequestDelegatingHandler that can intercept the response from the server and deserialise TTenantInfo from a header in the response containing Json.

2 is a stretch goal. Awaiting the cascaded Task<TenantInfo> in blazor , would cause a request to the server using option 1 if the task hasn't run before. Task is reused so this would only happen once unless invalidated.

dazinator avatar Aug 17 '19 20:08 dazinator