fix: removal of resteasy-core (#27032)
* fix: partial removal of resteasy-core Signed-off-by: Steve Hawkins <shawkins@redhat.com> * fix: fully removing resteasy-core closes: #26315 Signed-off-by: Steve Hawkins <shawkins@redhat.com> --------- Signed-off-by: Steve Hawkins <shawkins@redhat.com>
This commit is contained in:
parent
3e3cb2222d
commit
8d9439913c
17 changed files with 51 additions and 124 deletions
|
@ -61,11 +61,6 @@
|
||||||
<artifactId>keycloak-kerberos-federation</artifactId>
|
<artifactId>keycloak-kerberos-federation</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.jboss.resteasy</groupId>
|
|
||||||
<artifactId>resteasy-core</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.quarkus.resteasy.reactive</groupId>
|
<groupId>io.quarkus.resteasy.reactive</groupId>
|
||||||
<artifactId>resteasy-reactive-common</artifactId>
|
<artifactId>resteasy-reactive-common</artifactId>
|
||||||
|
|
|
@ -81,11 +81,6 @@
|
||||||
<groupId>org.hibernate.orm</groupId>
|
<groupId>org.hibernate.orm</groupId>
|
||||||
<artifactId>hibernate-core</artifactId>
|
<artifactId>hibernate-core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.jboss.resteasy</groupId>
|
|
||||||
<artifactId>resteasy-core</artifactId>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>jackson-databind</artifactId>
|
<artifactId>jackson-databind</artifactId>
|
||||||
|
|
|
@ -31,8 +31,8 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<!-- needed for LegacyExportImportManager that is calling ValidationUtil.validateClient (which is in server-spi-private) might throw a BadRequestException -->
|
<!-- needed for LegacyExportImportManager that is calling ValidationUtil.validateClient (which is in server-spi-private) might throw a BadRequestException -->
|
||||||
<!-- see: https://github.com/hmlnarik/keycloak/pull/23#discussion_r862293798 -->
|
<!-- see: https://github.com/hmlnarik/keycloak/pull/23#discussion_r862293798 -->
|
||||||
<groupId>org.jboss.resteasy</groupId>
|
<groupId>io.quarkus.resteasy.reactive</groupId>
|
||||||
<artifactId>resteasy-core</artifactId>
|
<artifactId>resteasy-reactive-common</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -43,10 +43,6 @@
|
||||||
<artifactId>hamcrest</artifactId>
|
<artifactId>hamcrest</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.jboss.resteasy</groupId>
|
|
||||||
<artifactId>resteasy-core</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.quarkus.resteasy.reactive</groupId>
|
<groupId>io.quarkus.resteasy.reactive</groupId>
|
||||||
<artifactId>resteasy-reactive-common</artifactId>
|
<artifactId>resteasy-reactive-common</artifactId>
|
||||||
|
|
|
@ -46,7 +46,6 @@ import io.quarkus.resteasy.reactive.server.spi.MethodScannerBuildItem;
|
||||||
import io.quarkus.runtime.configuration.ConfigurationException;
|
import io.quarkus.runtime.configuration.ConfigurationException;
|
||||||
import io.quarkus.runtime.configuration.ProfileManager;
|
import io.quarkus.runtime.configuration.ProfileManager;
|
||||||
import io.quarkus.vertx.http.deployment.RouteBuildItem;
|
import io.quarkus.vertx.http.deployment.RouteBuildItem;
|
||||||
import io.quarkus.resteasy.reactive.spi.IgnoreStackMixingBuildItem;
|
|
||||||
import io.smallrye.config.ConfigValue;
|
import io.smallrye.config.ConfigValue;
|
||||||
import org.eclipse.microprofile.health.Readiness;
|
import org.eclipse.microprofile.health.Readiness;
|
||||||
import org.hibernate.cfg.AvailableSettings;
|
import org.hibernate.cfg.AvailableSettings;
|
||||||
|
@ -61,7 +60,6 @@ import org.jboss.jandex.MethodInfo;
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
import org.jboss.resteasy.reactive.server.model.HandlerChainCustomizer;
|
import org.jboss.resteasy.reactive.server.model.HandlerChainCustomizer;
|
||||||
import org.jboss.resteasy.reactive.server.processor.scanning.MethodScanner;
|
import org.jboss.resteasy.reactive.server.processor.scanning.MethodScanner;
|
||||||
import org.jboss.resteasy.spi.ResteasyDeployment;
|
|
||||||
import org.keycloak.Config;
|
import org.keycloak.Config;
|
||||||
import org.keycloak.authentication.AuthenticatorSpi;
|
import org.keycloak.authentication.AuthenticatorSpi;
|
||||||
import org.keycloak.authentication.authenticators.browser.DeployedScriptAuthenticatorFactory;
|
import org.keycloak.authentication.authenticators.browser.DeployedScriptAuthenticatorFactory;
|
||||||
|
@ -208,11 +206,6 @@ class KeycloakProcessor {
|
||||||
return new DeployedScriptSAMLProtocolMapper(metadata);
|
return new DeployedScriptSAMLProtocolMapper(metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@BuildStep
|
|
||||||
IgnoreStackMixingBuildItem getIgnoreStackMixing() {
|
|
||||||
return new IgnoreStackMixingBuildItem();
|
|
||||||
}
|
|
||||||
|
|
||||||
@BuildStep
|
@BuildStep
|
||||||
FeatureBuildItem getFeature() {
|
FeatureBuildItem getFeature() {
|
||||||
return new FeatureBuildItem("keycloak");
|
return new FeatureBuildItem("keycloak");
|
||||||
|
@ -585,8 +578,8 @@ class KeycloakProcessor {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This will cause quarkus tu include specified modules in the jandex index. For example keycloak-services is needed as it includes
|
* This will cause quarkus to include specified modules in the jandex index. For example keycloak-services is needed as it includes
|
||||||
* most of the JAX-RS resources, which are required to register Resteasy builtin providers. See {@link ResteasyDeployment#isRegisterBuiltin()}.
|
* most of the JAX-RS resources, which are required to register Resteasy builtin providers.
|
||||||
* Similar reason is liquibase
|
* Similar reason is liquibase
|
||||||
*
|
*
|
||||||
* @param indexDependencyBuildItemBuildProducer
|
* @param indexDependencyBuildItemBuildProducer
|
||||||
|
|
|
@ -350,14 +350,14 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Keycloak Dependencies-->
|
<!-- Keycloak Dependencies-->
|
||||||
<dependency>
|
|
||||||
<groupId>org.jboss.resteasy</groupId>
|
|
||||||
<artifactId>resteasy-multipart-provider</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jboss.logging</groupId>
|
<groupId>org.jboss.logging</groupId>
|
||||||
<artifactId>commons-logging-jboss-logging</artifactId>
|
<artifactId>commons-logging-jboss-logging</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-io</groupId>
|
||||||
|
<artifactId>commons-io</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.webauthn4j</groupId>
|
<groupId>com.webauthn4j</groupId>
|
||||||
<artifactId>webauthn4j-core</artifactId>
|
<artifactId>webauthn4j-core</artifactId>
|
||||||
|
@ -541,25 +541,7 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jboss.resteasy</groupId>
|
<groupId>org.jboss.resteasy</groupId>
|
||||||
<artifactId>resteasy-core</artifactId>
|
<artifactId>resteasy-core-spi</artifactId>
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>log4j</groupId>
|
|
||||||
<artifactId>log4j</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.slf4j</groupId>
|
|
||||||
<artifactId>slf4j-api</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.slf4j</groupId>
|
|
||||||
<artifactId>slf4j-simple</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<groupId>org.jboss.spec.javax.servlet</groupId>
|
|
||||||
<artifactId>jboss-servlet-api_4.0_spec</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
|
|
|
@ -1,45 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2021 Red Hat, Inc. and/or its affiliates
|
|
||||||
* and other contributors as indicated by the @author tags.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.keycloak.quarkus.runtime.integration.jaxrs;
|
|
||||||
|
|
||||||
import jakarta.ws.rs.ext.Provider;
|
|
||||||
import java.lang.annotation.Annotation;
|
|
||||||
import java.lang.reflect.Type;
|
|
||||||
|
|
||||||
import org.jboss.resteasy.spi.ContextInjector;
|
|
||||||
import org.keycloak.common.util.Resteasy;
|
|
||||||
import org.keycloak.models.KeycloakSession;
|
|
||||||
import org.keycloak.quarkus.runtime.integration.resteasy.ResteasyVertxProvider;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>This {@link ContextInjector} allows injecting {@link KeycloakSession} to JAX-RS resources.
|
|
||||||
*
|
|
||||||
* <p>Due to the latest changes in Quarkus, the context map is cleared prior to dispatching to JAX-RS resources, so we need
|
|
||||||
* to delegate to the {@link ResteasyVertxProvider} provider the lookup of Keycloak contextual objects.
|
|
||||||
*
|
|
||||||
* @see ResteasyVertxProvider
|
|
||||||
*
|
|
||||||
* @author <a href="mailto:psilva@redhat.com">Pedro Igor</a>
|
|
||||||
*/
|
|
||||||
@Provider
|
|
||||||
public class KeycloakSessionContextInjector implements ContextInjector<KeycloakSession, KeycloakSession> {
|
|
||||||
@Override
|
|
||||||
public KeycloakSession resolve(Class rawType, Type genericType, Annotation[] annotations) {
|
|
||||||
return Resteasy.getContextData(KeycloakSession.class);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -20,16 +20,24 @@ package org.keycloak.quarkus.runtime.integration.resteasy;
|
||||||
import io.quarkus.arc.Arc;
|
import io.quarkus.arc.Arc;
|
||||||
import io.quarkus.vertx.http.runtime.CurrentVertxRequest;
|
import io.quarkus.vertx.http.runtime.CurrentVertxRequest;
|
||||||
import io.vertx.ext.web.RoutingContext;
|
import io.vertx.ext.web.RoutingContext;
|
||||||
import org.jboss.resteasy.core.ResteasyContext;
|
|
||||||
import org.keycloak.common.util.ResteasyProvider;
|
import org.keycloak.common.util.ResteasyProvider;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
public class ResteasyVertxProvider implements ResteasyProvider {
|
public class ResteasyVertxProvider implements ResteasyProvider {
|
||||||
|
|
||||||
|
private static final ThreadLocal<Map<Class<?>, Object>> contextualData = new ThreadLocal<Map<Class<?>, Object>>() {
|
||||||
|
@Override
|
||||||
|
protected Map<Class<?>, Object> initialValue() {
|
||||||
|
return new HashMap<>();
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <R> R getContextData(Class<R> type) {
|
public <R> R getContextData(Class<R> type) {
|
||||||
R data = ResteasyContext.getContextData(type);
|
R data = (R) contextualData.get().get(type);
|
||||||
|
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
RoutingContext contextData = Optional.ofNullable(Arc.container())
|
RoutingContext contextData = Optional.ofNullable(Arc.container())
|
||||||
|
@ -48,7 +56,7 @@ public class ResteasyVertxProvider implements ResteasyProvider {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void pushContext(Class type, Object instance) {
|
public void pushContext(Class type, Object instance) {
|
||||||
ResteasyContext.pushContext(type, instance);
|
contextualData.get().put(type, instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -58,7 +66,7 @@ public class ResteasyVertxProvider implements ResteasyProvider {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void clearContextData() {
|
public void clearContextData() {
|
||||||
ResteasyContext.clearContextData();
|
contextualData.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,6 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bouncycastle</groupId>
|
<groupId>org.bouncycastle</groupId>
|
||||||
<artifactId>bcpkix-fips</artifactId>
|
<artifactId>bcpkix-fips</artifactId>
|
||||||
<version>${bouncycastle.pkixfips.version}</version>
|
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -43,8 +43,8 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jboss.resteasy</groupId>
|
<groupId>io.quarkus.resteasy.reactive</groupId>
|
||||||
<artifactId>resteasy-core</artifactId>
|
<artifactId>resteasy-reactive-common</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -43,8 +43,8 @@
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jboss.resteasy</groupId>
|
<groupId>io.quarkus.resteasy.reactive</groupId>
|
||||||
<artifactId>resteasy-core</artifactId>
|
<artifactId>resteasy-reactive-common</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -19,7 +19,8 @@ package org.keycloak.models;
|
||||||
import static org.keycloak.common.util.UriUtils.parseQueryParameters;
|
import static org.keycloak.common.util.UriUtils.parseQueryParameters;
|
||||||
|
|
||||||
import jakarta.ws.rs.core.MultivaluedHashMap;
|
import jakarta.ws.rs.core.MultivaluedHashMap;
|
||||||
import org.jboss.resteasy.spi.ResteasyUriBuilder;
|
|
||||||
|
import org.jboss.resteasy.reactive.common.jaxrs.UriBuilderImpl;
|
||||||
import org.keycloak.urls.HostnameProvider;
|
import org.keycloak.urls.HostnameProvider;
|
||||||
import org.keycloak.urls.UrlType;
|
import org.keycloak.urls.UrlType;
|
||||||
|
|
||||||
|
@ -117,7 +118,7 @@ public class KeycloakUriInfo implements UriInfo {
|
||||||
to = this.getBaseUriBuilder().replaceQuery(null).path(uri.getPath()).replaceQuery(uri.getQuery()).fragment(uri.getFragment()).build(new Object[0]);
|
to = this.getBaseUriBuilder().replaceQuery(null).path(uri.getPath()).replaceQuery(uri.getQuery()).fragment(uri.getFragment()).build(new Object[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResteasyUriBuilder.relativize(from, to);
|
return UriBuilderImpl.relativize(from, to);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -102,8 +102,14 @@
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
<!-- for MockHttpRequest -->
|
||||||
<groupId>org.jboss.resteasy</groupId>
|
<groupId>org.jboss.resteasy</groupId>
|
||||||
<artifactId>resteasy-core</artifactId>
|
<artifactId>resteasy-core</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.quarkus.resteasy.reactive</groupId>
|
||||||
|
<artifactId>resteasy-reactive</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -130,7 +136,7 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jboss.resteasy</groupId>
|
<groupId>org.jboss.resteasy</groupId>
|
||||||
<artifactId>resteasy-multipart-provider</artifactId>
|
<artifactId>resteasy-core-spi</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.googlecode.owasp-java-html-sanitizer</groupId>
|
<groupId>com.googlecode.owasp-java-html-sanitizer</groupId>
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
|
|
||||||
package org.keycloak.authentication.authenticators.browser;
|
package org.keycloak.authentication.authenticators.browser;
|
||||||
|
|
||||||
import org.jboss.resteasy.specimpl.MultivaluedMapImpl;
|
|
||||||
import org.keycloak.authentication.AuthenticationFlowContext;
|
import org.keycloak.authentication.AuthenticationFlowContext;
|
||||||
import org.keycloak.authentication.Authenticator;
|
import org.keycloak.authentication.Authenticator;
|
||||||
import org.keycloak.forms.login.LoginFormsProvider;
|
import org.keycloak.forms.login.LoginFormsProvider;
|
||||||
|
@ -28,6 +27,7 @@ import org.keycloak.protocol.oidc.OIDCLoginProtocol;
|
||||||
import org.keycloak.services.ServicesLogger;
|
import org.keycloak.services.ServicesLogger;
|
||||||
import org.keycloak.services.managers.AuthenticationManager;
|
import org.keycloak.services.managers.AuthenticationManager;
|
||||||
|
|
||||||
|
import jakarta.ws.rs.core.MultivaluedHashMap;
|
||||||
import jakarta.ws.rs.core.MultivaluedMap;
|
import jakarta.ws.rs.core.MultivaluedMap;
|
||||||
import jakarta.ws.rs.core.Response;
|
import jakarta.ws.rs.core.Response;
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ public class UsernamePasswordForm extends AbstractUsernameFormAuthenticator impl
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void authenticate(AuthenticationFlowContext context) {
|
public void authenticate(AuthenticationFlowContext context) {
|
||||||
MultivaluedMap<String, String> formData = new MultivaluedMapImpl<>();
|
MultivaluedMap<String, String> formData = new MultivaluedHashMap<>();
|
||||||
String loginHint = context.getAuthenticationSession().getClientNote(OIDCLoginProtocol.LOGIN_HINT_PARAM);
|
String loginHint = context.getAuthenticationSession().getClientNote(OIDCLoginProtocol.LOGIN_HINT_PARAM);
|
||||||
|
|
||||||
String rememberMeUsername = AuthenticationManager.getRememberMeUsername(context.getSession());
|
String rememberMeUsername = AuthenticationManager.getRememberMeUsername(context.getSession());
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package org.keycloak.protocol.docker;
|
package org.keycloak.protocol.docker;
|
||||||
|
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
import org.jboss.resteasy.specimpl.ResponseBuilderImpl;
|
import org.jboss.resteasy.reactive.server.jaxrs.ResponseBuilderImpl;
|
||||||
import org.keycloak.events.EventBuilder;
|
import org.keycloak.events.EventBuilder;
|
||||||
import org.keycloak.events.EventType;
|
import org.keycloak.events.EventType;
|
||||||
import org.keycloak.jose.jws.JWSBuilder;
|
import org.keycloak.jose.jws.JWSBuilder;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package org.keycloak.protocol.docker;
|
package org.keycloak.protocol.docker;
|
||||||
|
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
import org.jboss.resteasy.specimpl.ResponseBuilderImpl;
|
import org.jboss.resteasy.reactive.server.jaxrs.ResponseBuilderImpl;
|
||||||
import org.keycloak.authentication.AuthenticationFlowContext;
|
import org.keycloak.authentication.AuthenticationFlowContext;
|
||||||
import org.keycloak.authentication.AuthenticationFlowError;
|
import org.keycloak.authentication.AuthenticationFlowError;
|
||||||
import org.keycloak.events.Errors;
|
import org.keycloak.events.Errors;
|
||||||
|
|
|
@ -18,13 +18,12 @@
|
||||||
package org.keycloak.services;
|
package org.keycloak.services;
|
||||||
|
|
||||||
import static jakarta.ws.rs.core.MediaType.MULTIPART_FORM_DATA_TYPE;
|
import static jakarta.ws.rs.core.MediaType.MULTIPART_FORM_DATA_TYPE;
|
||||||
import static jakarta.ws.rs.core.MediaType.TEXT_PLAIN_TYPE;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
|
||||||
import java.security.cert.X509Certificate;
|
import java.security.cert.X509Certificate;
|
||||||
import java.util.List;
|
import java.util.Collection;
|
||||||
import java.util.Map;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import jakarta.ws.rs.core.HttpHeaders;
|
import jakarta.ws.rs.core.HttpHeaders;
|
||||||
import jakarta.ws.rs.core.MediaType;
|
import jakarta.ws.rs.core.MediaType;
|
||||||
import jakarta.ws.rs.core.MultivaluedHashMap;
|
import jakarta.ws.rs.core.MultivaluedHashMap;
|
||||||
|
@ -32,9 +31,9 @@ import jakarta.ws.rs.core.MultivaluedMap;
|
||||||
import jakarta.ws.rs.core.UriInfo;
|
import jakarta.ws.rs.core.UriInfo;
|
||||||
import jakarta.ws.rs.ext.MessageBodyReader;
|
import jakarta.ws.rs.ext.MessageBodyReader;
|
||||||
import jakarta.ws.rs.ext.Providers;
|
import jakarta.ws.rs.ext.Providers;
|
||||||
import org.jboss.resteasy.core.ResteasyContext;
|
import org.jboss.resteasy.reactive.server.multipart.FormValue;
|
||||||
import org.jboss.resteasy.plugins.providers.multipart.InputPart;
|
import org.jboss.resteasy.reactive.server.multipart.MultipartFormDataInput;
|
||||||
import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput;
|
import org.keycloak.common.util.Resteasy;
|
||||||
import org.keycloak.http.FormPartValue;
|
import org.keycloak.http.FormPartValue;
|
||||||
import org.keycloak.http.HttpRequest;
|
import org.keycloak.http.HttpRequest;
|
||||||
|
|
||||||
|
@ -75,7 +74,7 @@ public class HttpRequestImpl implements HttpRequest {
|
||||||
return new MultivaluedHashMap<>();
|
return new MultivaluedHashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
Providers providers = ResteasyContext.getContextData(Providers.class);
|
Providers providers = Resteasy.getContextData(Providers.class);
|
||||||
MessageBodyReader<MultipartFormDataInput> multiPartProvider = providers.getMessageBodyReader(
|
MessageBodyReader<MultipartFormDataInput> multiPartProvider = providers.getMessageBodyReader(
|
||||||
MultipartFormDataInput.class, null, null, MULTIPART_FORM_DATA_TYPE);
|
MultipartFormDataInput.class, null, null, MULTIPART_FORM_DATA_TYPE);
|
||||||
MultipartFormDataInput inputs = multiPartProvider
|
MultipartFormDataInput inputs = multiPartProvider
|
||||||
|
@ -83,14 +82,12 @@ public class HttpRequestImpl implements HttpRequest {
|
||||||
delegate.getInputStream());
|
delegate.getInputStream());
|
||||||
MultivaluedHashMap<String, FormPartValue> parts = new MultivaluedHashMap<>();
|
MultivaluedHashMap<String, FormPartValue> parts = new MultivaluedHashMap<>();
|
||||||
|
|
||||||
for (Map.Entry<String, List<InputPart>> entry : inputs.getFormDataMap().entrySet()) {
|
for (Entry<String, Collection<FormValue>> entry : inputs.getValues().entrySet()) {
|
||||||
for (InputPart value : entry.getValue()) {
|
for (FormValue value : entry.getValue()) {
|
||||||
MediaType valueMediaType = value.getMediaType();
|
if (!value.isFileItem()) {
|
||||||
|
parts.add(entry.getKey(), new FormPartValueImpl(value.getValue()));
|
||||||
if (TEXT_PLAIN_TYPE.isCompatible(valueMediaType)) {
|
|
||||||
parts.add(entry.getKey(), new FormPartValueImpl(value.getBodyAsString()));
|
|
||||||
} else {
|
} else {
|
||||||
parts.add(entry.getKey(), new FormPartValueImpl(value.getBody(InputStream.class, null)));
|
parts.add(entry.getKey(), new FormPartValueImpl(value.getFileItem().getInputStream()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue