-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix OIDC IDP broker basic auth encoding #43058
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
Conversation
83da538 to
bc0b76a
Compare
ahus1
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR. I pushed one more commit to fix it at the source, so all other consumers of that method can benefit from it. I also checked the return value which is null.
To ensure that this works also in the future we need an integration test. Please provide one for this PR to proceed. Maybe @cgeorgilakis can help providing one.
Proposed test class to add : You could investigate any tests failure. |
|
I would be more comfortable updating the Also, I'm wondering if this note from OAuth2.1 spec is mentioning a problem with url encoding?
|
|
If we don't use the proposed fix, we should at least change the |
bc0b76a to
e14f170
Compare
@pedroigor - thank you for pointing this out. I reverted my changes to the PR, and added the test case @cgeorgilakis suggested. Let's wait for the CI. |
@sschu - the |
|
@pedroigor / @sschu - do you think this is a "notable" change for the migration guide, as it might break some people's implementations? While we should now be standard compliant, would we need to provide a switch to revert to the old behavior? I hope not... Also asking: Should this be backported? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unreported flaky test detected, please review
Unreported flaky test detectedIf the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR. org.keycloak.testsuite.account.AccountRestServiceTest#listApplicationsWithoutPermissionKeycloak CI - Java Distribution IT (windows-latest - temurin - 25) |
That’s why we mainly use Client Secret as POST. However, Client Secret as basic auth also exists. Another test was broken with change in CLIENT_SECRET. Will be a solution overridden this also in new test? |
cf9d862 to
e14f170
Compare
|
@cgeorgilakis - I wanted to update the test to also check if the test works for secrets that need URL encoding. While most tests did, the one that relied on values in the vault failed. I've reverted the change, and I assume the next build will be green. |
I saw this is a bit inconsistent across the codebase, in some places it is specified, in some places it isn't. I would probably prefer to have it explicit but its not urgent. |
I think I would mention this but not provide a compatibility switch since the old behaviour was essentially a bug. |
f9bca62 to
23fc353
Compare
|
@pedroigor - I've added a "notable change". Please review when you have the time, and then I would proceed with merging and backporting to 26.2 + 26.4 |
Ensures that the client_id and client_secret are URL-encoded before being Base64-encoded for the Basic Auth header, following RFC 6749. This fixes authentication failures when the client_id contains special characters. Closes keycloak#26374 Signed-off-by: rpjicond <[email protected]>
Co-authored-by: cgeorgilakis-grnet <[email protected]> Signed-off-by: Alexander Schwartz <[email protected]>
Signed-off-by: Alexander Schwartz <[email protected]>
23fc353 to
7ffb09d
Compare
Signed-off-by: Alexander Schwartz <[email protected]>
7ffb09d to
ff33fc8
Compare
|
@pedroigor / @cgeorgilakis / @sschu - I've updated this PR after talking to @srose as this change can break people's setup as we now start to use proper encoding. So the old behavior is now available, although you need to switch your configuration in case you want to use it. The new default behavior is the correct behavior. Please review and approve. Thanks! |
sschu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Ensures that the client_id and client_secret are URL-encoded before being Base64-encoded for the Basic Auth header, following RFC 6749. This fixes authentication failures when the client_id contains special characters.
Closes #26374
Closes #43022