-
Notifications
You must be signed in to change notification settings - Fork 3k
Use MultiMap set method instead of add for client assertion parameters #48880
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
Use MultiMap set method instead of add for client assertion parameters #48880
Conversation
Thanks a lot for the contribution! Is there any chance we could have a test for this? |
This comment has been minimized.
This comment has been minimized.
Thanks @Sopka, @geoand. Indeed, would be good to have a test. The test which sends a single request is here. I guess the simplest option is to do 2 calls in that test and tune the stub definition to fail if more than one client_assertion parameter is used. Or may be you can just update https://github.com/quarkusio/quarkus/blob/main/integration-tests/oidc-client-wiremock/src/main/java/io/quarkus/it/keycloak/OidcRequestCustomizer.java to check if the body contains only one of those parameters. Have a look please, I can help if you'd like |
Ensure that all subsequent requests to the OIDC server's token endpoint include the correct number of form parameters in the POST data.
e1cbcfa
to
dce6637
Compare
Added a test that makes multiple requests to the OIDC token endpoint using a filter configuration that always forces new token requests. This approach avoids issues with simulating token expiration and eliminates the need to wait for tokens to expire. The test verifies that each request sends the expected form parameters. |
Status for workflow
|
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.
Go ahead and merge as is |
The issue is in OidcClientImpl.java, where
add()
is used instead ofset()
for JWT bearer authentication parameters. Other authentication methods correctly useset()
.This causes a mismatch between the expected behavior (replacing previous values) and the actual behavior (accumulating values).
Replaced the
add()
method calls withset()
in the JWT bearer authentication code path:This would ensure only the newest key-value pairs are included in the request, eliminating the duplication problem.