Using DPoP with IHttpClientFactory guidance needed #75
Replies: 0 comments 6 replies
-
When you're creating an var handler = _oidcClient.CreateDPoPHandler(proofKey, refreshToken, handlerFromYourProxy); If your library is dealing entirely with an |
Beta Was this translation helpful? Give feedback.
-
My goal was to configure Your comments did get me unblocked thought, but it's ugly as sin, passing around two different funcs, one to configure the HttpClient and one to create the right inner handler. One thing to note this is not a proxy library. This is standard .NET Core To make it more interesting I use .NET's |
Beta Was this translation helpful? Give feedback.
-
Are you able to share a bit of the ugly code? I'd like to make this better :) |
Beta Was this translation helpful? Give feedback.
-
Certainly can This is a horrible work in progress, so feel free to poke holes in my code, it'd be rather Brock 😂 |
Beta Was this translation helpful? Give feedback.
-
Oh, this is what you've been posting about on Bluesky - cool! It seems like the problem comes from the fact that we have 2 different ways to configure the backchannel http client - you can simply set a handler value ( Internally, And that forces ugly code like this:
When you really just want to configure the So ideally, I think it would be easy to make it respect the Dealing with the |
Beta Was this translation helpful? Give feedback.
-
And because that needs state the whole .NET IHttpClientFactory approach breaks down (I'm being very grumpy about this internally). This is where documentation would help :) I'm just hoping the DPoP stuff will work on an HttpRequest and HttpResponse, because I really need to avoid all this mess when it comes to making signed requests, the factory is there to manage handler lifetimes and reduce the overhead of creating HttpClients each time. |
Beta Was this translation helpful? Give feedback.
-
As part of supporting proxies I have a library that configures its own named client and configures an appropriate handler for the proxy configuration and a little bit more.
If someone sets a proxy it's probably for a good reason, or for running everything through fiddler, and so I want to flow that down to the OIDC client. Which is fine, I can set the
HttpClientFactory
inOidcClientOptions
but ... of course, if I do that the handler doesn't get wired up and DPoP fails.If I remove the handler settings, DPoP works but nothing goes through the proxy. I went looking for a sample of the two working together but didn't find anything. How do I get them all to play nicely together?
Beta Was this translation helpful? Give feedback.
All reactions