Replies: 1 comment 2 replies
-
I did implement a tiny bit nicer solution, which works and passes along the jwt token in the authorization header.
and in Program.cs
|
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I need to add a header on each request from Blazor to the server, but currently it feels wrong to me.
Current solution in Program.cs Main:
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
And the HttpClient is injected into the Csla HttpProxy. I think the current solution is to implement a custom HttpProxy and override GetHttpClient and do stuff there.
However I think it would be better to allow HttpClientFactory or Typed HttpClient and use AddHttpClient and explicitly define it for a new class DataportalHttpClient which should be used in HttpProxy.
This gives more flexibility, in this case I add BaseAddressAuthorizationMessageHandler, this ensures that an accesstoken is passed along to the server which will be validated beside trusting the deserialized claimsprincipal which could be manually modified.
Beta Was this translation helpful? Give feedback.
All reactions