Skip to content

Support for customizing request and response body in OIDC filters #49042

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

Merged
merged 1 commit into from
Jul 23, 2025

Conversation

sberyozkin
Copy link
Member

Fixes #49041.
Fixes #40258.

This PR provides a simple option for OidcRequestFilter implementations to customize a request body and for OidcResponseFilter implementations to customize a response body, by depending on a shared OidcRequestContextProperties map as a medium to pass the updated content back to the runtime

@gastaldi gastaldi requested a review from Copilot July 22, 2025 13:41
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements support for customizing request and response bodies in OIDC filters by adding new constants to OidcRequestContextProperties and modifying the filtering mechanism to check for and apply custom request/response bodies through shared context properties.

  • Adds REQUEST_BODY and RESPONSE_BODY constants to OidcRequestContextProperties for filter customization
  • Updates filtering logic across OIDC components to support custom request/response body handling
  • Provides comprehensive documentation and test coverage for the new functionality

Reviewed Changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
OidcRequestContextProperties.java Adds new constants for request and response body customization
OidcCommonUtils.java Implements utility methods for handling custom request/response bodies
Various OIDC runtime files Updates filtering calls to use new body customization support
Test files Adds integration tests demonstrating request/response body customization
Documentation files Updates documentation with examples of the new filtering capabilities
Comments suppressed due to low confidence (1)

docs/src/main/asciidoc/security-openid-connect-client-registration.adoc:569

  • [nitpick] Class name 'ClientRegistrationReRequestFilter' contains 'ReRequest' which appears to be a typo. Consider 'ClientRegistrationRequestFilter' instead.
public class ClientRegistrationReRequestFilter implements OidcRequestFilter {

@sberyozkin sberyozkin force-pushed the oidc_filter_request_body branch from 9f25a4b to 46435be Compare July 22, 2025 13:51
@sberyozkin
Copy link
Member Author

Thanks @gastaldi, Copilot was helpful yet again, I was copying/pasting some code examples across several docs and ended up with some non-compiling code in one of the docs :-)

This comment has been minimized.

Copy link

github-actions bot commented Jul 22, 2025

🙈 The PR is closed and the preview is expired.

@sberyozkin
Copy link
Member Author

Sorry, looks like NPE is showing up, in some cases, the code I added assumes the buffer that is checked is never null

This comment has been minimized.

@sberyozkin
Copy link
Member Author

Sorry again, so OidcRequestContextProperties are set to null when no request and/or response filters are registered, which is the case for many tests, and that was causing NPE because this PR assumed OidcRequestContextProperties was never null when checking if t had an updated body recorded

Copy link
Member

@michalvavrik michalvavrik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just spend last hours modifying similar classes #46697 so I am not super happy to see this PR 😀 but it looks fine. I left one opinion as I'd implement it differently, but it's optional. LGTM.

This comment has been minimized.

This comment has been minimized.

@sberyozkin sberyozkin force-pushed the oidc_filter_request_body branch from d0fdde0 to 50b1a85 Compare July 22, 2025 22:05
Copy link

quarkus-bot bot commented Jul 22, 2025

Status for workflow Quarkus CI

This is the status report for running Quarkus CI on commit 50b1a85.

✅ The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.

You can consult the Develocity build scans.

Copy link

quarkus-bot bot commented Jul 22, 2025

Status for workflow Quarkus Documentation CI

This is the status report for running Quarkus Documentation CI on commit 50b1a85.

✅ The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.

Copy link
Member

@michalvavrik michalvavrik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@sberyozkin sberyozkin merged commit 7e7c1fe into quarkusio:main Jul 23, 2025
31 checks passed
@quarkus-bot quarkus-bot bot added this to the 3.26 - main milestone Jul 23, 2025
@sberyozkin sberyozkin deleted the oidc_filter_request_body branch July 23, 2025 07:58
@quarkus-bot quarkus-bot bot added the kind/enhancement New feature or request label Jul 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for customizing the body in OIDC request and response filters OidcClientImpl should support JsonPath for extracting the Access Token
3 participants