-
Notifications
You must be signed in to change notification settings - Fork 39
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
Fix encoding of client id and secret in HTTP Basic #171
Conversation
Per https://datatracker.ietf.org/doc/html/rfc6749#section-2.3.1 the parameters first need to be url encoded.
Definitely missed that! Thank you |
This implementation is unfortunately not correct. Please see a reference of how it could be done properly. |
I will open next PR to make it fully compliant. |
Reading the appendix, I fail to see what's wrong (but might be missing something) the implementation you shared encodes space as + and encodes more characters than I'd love to see a source that supports this requirement, I just don't get that from the appendix alone. (it also feels a bit silly, only non-ascii and |
I appreciate the flag though @panva ! |
AFAIU the scheme of encoding as defined in the spec is fully deterministic, so I can imagine a hypothetical case of the authorization server doing a string comparison on encoded, not decoded values. |
It feels a tad theoretical, but would |
Out of the alphabet that needs escaping Using |
This is a mess IMHO... The primary difference is that https://datatracker.ietf.org/doc/html/rfc6749#appendix-B explicitly says
which says (emphasis mine):
Now, things like So, effectively, to be the most strict interpretation requires encoding everything non-alphanumeric (and special treatment of space...) |
Yes it is a mess, which is why we're switching from OAuth 2.0 Basic (MUST support) and Body (MAY, NOT RECOMMENDED) to OAuth 2.1 Body (MUST support) and Basic (MAY, NOT RECOMMENDED) |
Amends 49d3241 per discussion in badgateway#171 with the most strict interpretation of required encoding for the HTTP Basic Authentication user and password.
Per https://datatracker.ietf.org/doc/html/rfc6749#section-2.3.1 the parameters first need to be url encoded.