0
votes

I'm experimenting with Service fabric in C# . I have Custom App Gateway (stateless ASP.NET CORE service). App Gateway service is one public accessible endpoint and provide user authentication (AAD B2C) in one place. After user login ist JWT Token forwarded to the one Front-end web service to process request (app have many front-end services). I would like call multiple Back-end services from each Front-end web service with JWT Token. I have solution how to achieve this in ASP.NET CORE (stateless and stateful services - using HTTP Client with KESTREL).

But.... I don't know, how to forward JWT or some other header from App Gateway to "only" . NET Core services (for example actor service). Is this please possible with service remoting? Is good approach forward JWT token to all backend services?

Thank you very much

1

1 Answers

1
votes

You can add custom headers to remoting calls. You can do this, by implementing a custom implementation of IServiceRemotingClientFactory and IServiceRemotingClient that adds custom headers during a request (in RequestResponseAsync).

Next, implement the receiving side, by implementing IServiceRemotingClientFactory and IServiceRemotingClient to read the custom headers.

Here is an example: expecho on github Another example here.