Skip to content
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 Vert.x BodyHandler #5978

Closed

Conversation

stuartwdouglas
Copy link
Member

@stuartwdouglas stuartwdouglas commented Dec 6, 2019

Fixes #5959

This change allows the body handler to be used for Undertow
and RESTEasy standalone. When the request is fully buffered
it can be consumed multiple times, which allows keycloak
to also process it.

@@ -21,6 +22,12 @@ FeatureBuildItem featureBuildItem() {
return new FeatureBuildItem(FeatureBuildItem.KEYCLOAK_AUTHORIZATION);
}

@BuildStep
RequireBodyHandlerBuildItem requireBody() {
//TODO: this should only be produced if required, ask Pedro about config for this
Copy link
Member Author

Choose a reason for hiding this comment

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

@pedroigor how can we tell if the request needs to be fully buffered or not?

}
}

return value;
Copy link
Member

@gsmet gsmet Dec 6, 2019

Choose a reason for hiding this comment

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

What's the reason for this change? It looks a bit unrelated and unexpected.

Copy link
Contributor

Choose a reason for hiding this comment

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

@gsmet Indeed, the reason behind it is that otherwise, we would need a Keycloak release to just fix how we are checking the content type. The code here is basically removing the charset so that the code we are relying on from Keycloak can work as expected.

Copy link
Member Author

Choose a reason for hiding this comment

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

That was part of @pedroigor original approach, I don't think it is needed so I might modify the PR to just keep the tests and not the rest of the changes.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, the change is not related with this one but to #5959

Copy link
Member

Choose a reason for hiding this comment

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

OK, then this needs proper documentation with a TODO pointing to a GH issue so that we remove it in the future.

@stuartwdouglas stuartwdouglas force-pushed the vertx-body-handler branch 3 times, most recently from ec08512 to ceacd10 Compare December 6, 2019 09:55
Fixes quarkusio#5959

This change allows the body handler to be used for Undertow
and RESTEasy standalone. When the request is fully buffered
it can be consumed multiple times, which allows keycloak
to also process it.
}
}

return value;
Copy link
Contributor

Choose a reason for hiding this comment

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

@gsmet Indeed, the reason behind it is that otherwise, we would need a Keycloak release to just fix how we are checking the content type. The code here is basically removing the charset so that the code we are relying on from Keycloak can work as expected.

Copy link
Contributor

@pedroigor pedroigor left a comment

Choose a reason for hiding this comment

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

@stuartwdouglas you need to remove any change related to tests because the previous change I did to content type (VertxHttpFacade) is not here anymore (but will be sent separately on top of your work). Otherwise, the test will fail. The files that should be reverted are: ProtectedResource, application.properties and PolicyEnforcerTest.

@gsmet
Copy link
Member

gsmet commented Dec 6, 2019

Superseded by #5981 which includes this work.

@gsmet gsmet closed this Dec 6, 2019
@gsmet gsmet added triage/out-of-date This issue/PR is no longer valid or relevant triage/invalid This doesn't seem right and removed triage/out-of-date This issue/PR is no longer valid or relevant labels Dec 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage/invalid This doesn't seem right
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Keycloak Claim Information Point - NPE when trying to read body
3 participants