Skip to content

Add support for DelegatingHandler #1131

Closed

Description

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.

Activity

  1. jmprieur commented on Apr 9, 2021

    @jmprieur
    Collaborator

    Thanks Guillaume ROUCHON (@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.
  2. qetza commented on Jul 22, 2021

    @qetza
    ContributorAuthor

    Any idea when the PR will be included and released?

  3. added this to the 1.15.0 milestone on Jul 22, 2021
  4. jennyf19 commented on Jul 26, 2021

    @jennyf19
    Collaborator

    Included in 1.15 release

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

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions