Introspection does not work in .net 6.0
See original GitHub issueDear developers 😃
Thank you for the introspection auth handler for asp.net. Sadly, I’m experiencing a weird behaviour: I try to use the handler to authenticate against a local “oidc-provider” instance (nodejs). The provider delivers an opaque (reference) token. That’s the reason for the oauth2introspection handler.
With the following config:
builder.Services
.AddAuthentication("token")
.AddOAuth2Introspection("token", o =>
{
o.Authority = builder.Configuration.GetSection("Oidc").GetValue<string>("Issuer");
o.ClientId = "wire-pact";
o.ClientSecret = "demo-oidc-provider";
});
I only receive the following log messages:
dbug: Microsoft.AspNetCore.Routing.Matching.DfaMatcher[1005]
Endpoint 'OidcApi.Controllers.SwapiController.GetPeople (OidcApi)' with route pattern 'swapi/people' is valid for the request path '/swapi/people'
dbug: Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware[1]
Request matched endpoint 'OidcApi.Controllers.SwapiController.GetPeople (OidcApi)'
info: Microsoft.AspNetCore.Authorization.DefaultAuthorizationService[2]
Authorization failed. These requirements were not met:
DenyAnonymousAuthorizationRequirement: Requires an authenticated user.
info: IdentityModel.AspNetCore.OAuth2Introspection.OAuth2IntrospectionHandler[12]
AuthenticationScheme: token was challenged.
dbug: Microsoft.AspNetCore.Server.Kestrel.Connections[9]
Connection id "0HMGCSJFNL7LQ" completed keep alive response.
info: Microsoft.AspNetCore.Hosting.Diagnostics[2]
Request finished HTTP/1.1 GET http://localhost:5000/swapi/people - - - 401 0 - 7.3836ms
I made the config according to the docs: https://docs.duendesoftware.com/identityserver/v6/apis/aspnetcore/reference/
What did I do wrong? 😃
Could you give any hint where my errors are? Regards
Issue Analytics
- State:
- Created a year ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
dotnet core IdentityModel will not introspect tokens
1 Answer 1 · 1. Has anyone been able to get this working? I am running into the same problem. Tokens are being...
Read more >What's new in ASP.NET Core 6.0
This article highlights the most significant changes in ASP.NET Core 6.0 with links to relevant documentation.
Read more >Protect dotnet Core webapi with OAuth Introspection
I am trying to build a bespoke DotNet Core web API protected by ISVaaS, using OAuth introspection. I've had problems getting the native ......
Read more >You must either set Authority or IntrospectionEndpoint #1627
I'm sending a jwt so it seems to me that the back channel communication is not necessary and thus the secret shouldn't be...
Read more >Flexible Access Token Validation in ASP.NET Core
To solve the problem, we created a brand new authentication handler that acts like a decorator over the JWT and introspection handler.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yea, it’s strange that Microsoft throws in the UseAuthorization in their templates, but omit UseAuthetication. It’s sort of like “duh”. shrug
Holy moly. THANK YOU! @brockallen I’m sorry. Should’ve seen that.
Thank you 😉