abp
abp copied to clipboard
Setting up customer interceptors in conjunction with dynamic C# proxies
Is there an existing article or article request for this?
- [X] I have searched the existing resources
Describe the article you'd like
I am looking for documentation that would explain how to do the following (in my opinion fairly straightforward) usecase:
- Register two dynamic c# http client proxies, e.g. one for "FoobarService" and one for "BazbarService" (presumably using
AddHttpClientProxies. The service "MyEntryService" will interact with these to services in the back. The user with authenticate against "MyEntryService" - Create a custom interceptor, which will intercept outgoing requests, fetch the existing "Authorization" header from httpContext, and append it to the outgoing request.
- Attach that interceptor only to "FoobarService". I.e., for "BazbarService" we do not wish to add this header.
I am fairly certain I need to implement an "AbpInterceptor" for this (or more specifically, override the DynamicHttpProxyInterceptor) and then I need to attach it specifically to FoobarService
hi
Maybe you can override the IRemoteServiceHttpClientAuthenticator to fetch the existing "Authorization" header from httpContext, and append it to the outgoing request.