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

Add support for DelegatingHandler #1131

Closed
qetza opened this issue Apr 9, 2021 · 3 comments
Closed

Add support for DelegatingHandler #1131

qetza opened this issue Apr 9, 2021 · 3 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@qetza
Copy link
Contributor

qetza commented Apr 9, 2021

Is your feature request related to a problem? Please describe.
Currently for using Microsoft.Identity.Web when calling APIs you have to use IDownstreamWebApi or do it manually through ITokenAcquisition. This can be complicated/time consuming for existing applications.

Describe the solution you'd like
It would be a good solution to provide a DelegatingHandler which would use ITokenAcquisition to get a token and inject it in the Authorization HTTP headers. This way you only have to update your Startup class where you register your HTTP clients.
This can also benefit for teams that prefer managing all HTTP connection transversal topics through DelegatingHandler (Polly...).

Describe alternatives you've considered

Additional context
I've already discuss this with Jean-Marc and as I have a basic implementation done I will send PR.

@qetza qetza added the enhancement New feature or request label Apr 9, 2021
@jmprieur
Copy link
Collaborator

jmprieur commented Apr 9, 2021

Thanks @qetza

The options to call an API would then become:

  • If you want to use Microsoft Graph, inject GraphServiceClient
  • If you want to call a REST API handling Json and don’t have an SDK, use IDownstreamWebApi
  • If you are using an SDK:
    • If this is an Azure SDK, use the TokenAcquisitionTokenCredential which was introduced in 1.9
    • If this is another SDK that takes an Http delegate handler, then use a (new class to be provided) TokenAcquisitionDelegateHandler
    • If this is another SDK that requires a token, just use ITokenAcquisition.

@qetza
Copy link
Contributor Author

qetza commented Jul 22, 2021

Any idea when the PR will be included and released?

@jennyf19 jennyf19 added this to the 1.15.0 milestone Jul 22, 2021
@jennyf19
Copy link
Collaborator

Included in 1.15 release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants