-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Supporting basic authentication Token exchange in both the OAuth2 and OIDC handlers #10615
Comments
Yeah, the logic is not standard-compliant. Not sure whether it's an oversight or not (I guess it is), but here's an example of a valid basic header construction: https://github.com/aspnet-contrib/AspNet.Security.OAuth.Extensions/blob/378348bb4efb1d277020e2a55f41a546368f7a31/src/AspNet.Security.OAuth.Introspection/OAuthIntrospectionHandler.cs#L414-L429 /cc @martincostello |
@PinpointTownes I'll look at updating that in aspnet-contrib/AspNet.Security.OAuth.Providers#280 based on the above sample. |
Ensure basic authentication token encoding is standard-compliant. See dotnet/aspnetcore#10615 (comment).
Ensure basic authentication token encoding is standard-compliant. See dotnet/aspnetcore#10615 (comment).
Ensure basic authentication token encoding is standard-compliant. See dotnet/aspnetcore#10615 (comment).
@Tratcher Is there any plans to implement this in the |
@prochnowc no plans at present. Only a few providers have required it, and even they don't use standard implementations. You can handle this today the same way they did for FitBit. |
Just throwing my two cents on this ticket as I've also ran into this recently (also ended up using a similar method to the FitBit handler so no biggie). Since its defined in the RFC it would be nice to have it as an option for those very few providers who do implement it as per the spec. |
Curiously, the documentation contains a description of TokenEndpointAuthMethodsSupported, but it appears to be unimplemented. At least for me, this has no effect:
|
@Tratcher a whole rewrite of ExchangeCodeAsync() to support client_secret_basic is a bad idea (at least in my opinion) because you decouple from further improvements in the development and run the risk of incompatibilities. The linked FitBit code is a good example for that, it doesn't support PKCE verifier_code like the original implementation does. That results in trouble if your identity provider relies on PKCE (like ADFS) or expects verifier_code in the token request if you sent code_challenge in the authorization request (like GitLab). If I may wish for something, implement client_secret_basic or split ExchangeCodeAsync() in one part for content creation and another one for transmission. That gives us a chance to adjust content in dedicated points before transmission without the need to generate it from scratch. |
It's worth noting that the permalink present in the OP points to an old commit: the implementation has since been updated to optionally support PKCE (which isn't too terrible as it requires just 5 lines of code, braces included: https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers/blob/dev/src/AspNet.Security.OAuth.Fitbit/FitbitAuthenticationHandler.cs) As part of the OpenIddict web providers development, I had to implement and test ~60 integrations (including a lot of providers we already support via aspnet-contrib), so I can shed some - fresh - light for those who are interested:
Conclusion: it's sadly still a hot mess. |
#9448 (comment)
OAuth and OIDC have a standard flow of sending the clientid and secret to the token endpoint using a custom basic auth format. 4 of the auth handlers in aspnet-contrib require this flow and have to implement it manually. We expect many other providers also support this format since it's the one required in the spec.
Note the encoding is customized in the OAuth spec. (I don't think the FitBit handler is following that).
https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers/blob/aad5420654c65b5fb9908ddf298dbab17076338c/src/AspNet.Security.OAuth.Fitbit/FitbitAuthenticationHandler.cs#L66-L70
@PinpointTownes
The text was updated successfully, but these errors were encountered: