Identityserver4: IntrospectionBackChannelHandler and InstrospectionDiscoveryHandler

Created on 24 Sep 2019  路  6Comments  路  Source: IdentityServer/IdentityServer4

After upgrading to latest IdentityServer4, the following properties are missing:

var options = new IdentityServerAuthenticationOptions();
options.IntrospectionBackChannelHandler = identityServerHttpMessageHandler;
options.IntrospectionDiscoveryHandler = identityServerHttpMessageHandler;

Were these moved, or are they no longer available? I use them for unit testing.

question

Most helpful comment

@ramanathants I had to dig through the code a bit, but the new way to do it is to inject an HttpClient into your DI container with a name like so:

// Specify the HTTP client to use when IdentityModel is performing authentication.
services.AddHttpClient(OAuth2IntrospectionDefaults.BackChannelHttpClientName)
   .AddHttpMessageHandler(() => TestMessageHandler);

All 6 comments

This is not part of identityserver - but the oauth introspection handler.

Yes they are gone. Check this repo how to use it - including tests.

https://github.com/IdentityModel/IdentityModel.AspNetCore.OAuth2Introspection

I am having the similar issue. I was using IntrospectionBackChannelHandler & InstrospectionDiscoveryHandler in the similar way Josh mentioned for my integration tests. The above link doesn't provide me a clear example on how to use it in a new way? Would you be able to provide an concrete example on how to fix this? Thanks

@ramanathants I had to dig through the code a bit, but the new way to do it is to inject an HttpClient into your DI container with a name like so:

// Specify the HTTP client to use when IdentityModel is performing authentication.
services.AddHttpClient(OAuth2IntrospectionDefaults.BackChannelHttpClientName)
   .AddHttpMessageHandler(() => TestMessageHandler);

Yes - that's right.

Thank you @joshmouch !

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings