Closed dprochownik closed 8 years ago
Would it be possible use a simple handler which accepts a delegate?
public class Handler : System.Net.Http.HttpMessageHandler
{
private readonly Func<HttpRequestMessage, CancellationToken, Task<HttpResponseMessage>> SendCoreAsync;
public Handler(Func<HttpRequestMessage, CancellationToken, Task<HttpResponseMessage>> sender)
{
SendCoreAsync = sender;
}
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
return SendCoreAsync(request, cancellationToken);
}
}
Why not host them in 2 different pipelines?
Are there any chances that BackchannelHttpHandler in IdentityServerBearerTokenAuthenticationOptions will be an expression instead of object instance or there will be some other possibility for lazy set of back channel?
I mean by this something like BackchannelHttpHandler = () => myCustomInMemoryOwinHttpMessageHandler
When IdSrv3 and API which uses app.UseIdentityServerBearerTokenAuthentication(authOptions) are hosted in a single OWIN project, and both are set up in a single application startup, there is no possibility to set BackchannelHttpHandler for in-memory integration testing because OwinHttpMessageHandler could be created only after app.Build().
Sample of using OwinHttpMessageHandler can be found here: http://dhickey.ie/2015/04/testing-owin-applications-with-httpclient-and-owinhttpmessagehandler/