Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting up customer interceptors in conjunction with dynamic C# proxies #19442

Open
1 task done
karlschriek opened this issue Mar 28, 2024 · 1 comment
Open
1 task done

Comments

@karlschriek
Copy link

Is there an existing article or article request for this?

  • 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:

  1. 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"
  2. Create a custom interceptor, which will intercept outgoing requests, fetch the existing "Authorization" header from httpContext, and append it to the outgoing request.
  3. 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

@maliming
Copy link
Member

hi

Maybe you can override the IRemoteServiceHttpClientAuthenticator to fetch the existing "Authorization" header from httpContext, and append it to the outgoing request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants