IdentityModel / IdentityModel.AspNetCore.OAuth2Introspection

ASP.NET Core authentication handler for OAuth 2.0 token introspection
Apache License 2.0
147 stars 66 forks source link

X509Certificate2 not accepted #140

Closed malah-code closed 2 years ago

malah-code commented 3 years ago

I have a situation where my OpenID Connect server is configured to use client certificates (request must be sent with X509Certificate2 (pfx) client certificate ) , I couldn't find anyway to pass this certificate with request.

Also I did a workaround by try to use ConfigurePrimaryHttpMessageHandler before services.AddAuthentication in Startup.cs

            var clientCertificate =new X509Certificate2(@"C:\Temp\my.pfx", "passToPfx");
            var handler = new HttpClientHandler();
            handler.ClientCertificates.Add(clientCertificate);
            services.AddHttpClient(OAuth2IntrospectionDefaults.BackChannelHttpClientName, c =>
            {
            }).ConfigurePrimaryHttpMessageHandler(() => handler);

but that didn't work and I keep getting below error

fail: IdentityModel.AspNetCore.OAuth2Introspection.OAuth2IntrospectionHandler[0] Error returned from introspection endpoint: Unauthorized

any idea how to do that? and is it an issue in the this Nuget?

github-actions[bot] commented 2 years ago

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