added PATCH and PUT methods to get FormBodyHandler (#25093)

Signed-off-by: Garth <244253+xgp@users.noreply.github.com>
This commit is contained in:
Garth 2023-12-01 14:00:44 +01:00 committed by GitHub
parent b8467d80f1
commit ba790f1bca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,7 +17,9 @@
package org.keycloak.quarkus.runtime.integration.resteasy; package org.keycloak.quarkus.runtime.integration.resteasy;
import static jakarta.ws.rs.HttpMethod.PATCH;
import static jakarta.ws.rs.HttpMethod.POST; import static jakarta.ws.rs.HttpMethod.POST;
import static jakarta.ws.rs.HttpMethod.PUT;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
@ -51,7 +53,10 @@ public final class KeycloakHandlerChainCustomizer implements HandlerChainCustomi
switch (phase) { switch (phase) {
case BEFORE_METHOD_INVOKE: case BEFORE_METHOD_INVOKE:
if (POST.equalsIgnoreCase(resourceMethod.getHttpMethod())) { if (!resourceMethod.isFormParamRequired() &&
(PATCH.equalsIgnoreCase(resourceMethod.getHttpMethod()) ||
POST.equalsIgnoreCase(resourceMethod.getHttpMethod()) ||
PUT.equalsIgnoreCase(resourceMethod.getHttpMethod()))) {
handlers.add(formBodyHandler); handlers.add(formBodyHandler);
} }
handlers.add(TRANSACTIONAL_SESSION_HANDLER); handlers.add(TRANSACTIONAL_SESSION_HANDLER);