From 67d8ca0207db6083fd884ec47b04a4ed57eddb2e Mon Sep 17 00:00:00 2001 From: Stian Thorgersen Date: Thu, 8 Oct 2015 20:15:53 +0200 Subject: [PATCH] KEYCLOAK-1896 Search for users returns null values --- core-jaxrs/pom.xml | 66 ------------------- dependencies/server-min/pom.xml | 4 -- .../keycloak-core-jaxrs/main/module.xml | 20 ------ .../WEB-INF/jboss-deployment-structure.xml | 1 - .../keycloak-services/main/module.xml | 1 - .../eap6/eap6-server-modules/build.xml | 4 -- .../eap6/eap6-server-modules/pom.xml | 4 -- .../WEB-INF/jboss-deployment-structure.xml | 1 - .../keycloak-core-jaxrs/main/module.xml | 20 ------ .../keycloak-services/main/module.xml | 1 - pom.xml | 6 -- services/pom.xml | 4 -- .../resources/KeycloakApplication.java | 12 ++-- .../services/util/ObjectMapperResolver.java | 14 ++-- testsuite/performance/pom.xml | 4 -- 15 files changed, 8 insertions(+), 154 deletions(-) delete mode 100755 core-jaxrs/pom.xml delete mode 100755 distribution/feature-packs/server-feature-pack/src/main/resources/modules/system/layers/base/org/keycloak/keycloak-core-jaxrs/main/module.xml delete mode 100755 distribution/server-overlay/eap6/eap6-server-modules/src/main/resources/modules/org/keycloak/keycloak-core-jaxrs/main/module.xml rename core-jaxrs/src/main/java/org/keycloak/SkeletonKeyContextResolver.java => services/src/main/java/org/keycloak/services/util/ObjectMapperResolver.java (63%) diff --git a/core-jaxrs/pom.xml b/core-jaxrs/pom.xml deleted file mode 100755 index 6822b3a6c5..0000000000 --- a/core-jaxrs/pom.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - keycloak-parent - org.keycloak - 1.6.0.Final-SNAPSHOT - ../pom.xml - - 4.0.0 - - keycloak-core-jaxrs - Keycloak Core JAX-RS - - - - - org.jboss.resteasy - resteasy-jaxrs - provided - - - org.keycloak - keycloak-core - provided - - - org.codehaus.jackson - jackson-core-asl - provided - - - org.codehaus.jackson - jackson-mapper-asl - provided - - - org.jboss.resteasy - resteasy-jackson-provider - provided - - - org.jboss.spec.javax.servlet - jboss-servlet-api_3.0_spec - provided - - - junit - junit - test - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - ${maven.compiler.source} - ${maven.compiler.target} - - - - - - diff --git a/dependencies/server-min/pom.xml b/dependencies/server-min/pom.xml index 7e1565ee22..71807a5332 100755 --- a/dependencies/server-min/pom.xml +++ b/dependencies/server-min/pom.xml @@ -31,10 +31,6 @@ org.bouncycastle bcpkix-jdk15on - - org.keycloak - keycloak-core-jaxrs - org.keycloak keycloak-services diff --git a/distribution/feature-packs/server-feature-pack/src/main/resources/modules/system/layers/base/org/keycloak/keycloak-core-jaxrs/main/module.xml b/distribution/feature-packs/server-feature-pack/src/main/resources/modules/system/layers/base/org/keycloak/keycloak-core-jaxrs/main/module.xml deleted file mode 100755 index 888c32a0fd..0000000000 --- a/distribution/feature-packs/server-feature-pack/src/main/resources/modules/system/layers/base/org/keycloak/keycloak-core-jaxrs/main/module.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/distribution/feature-packs/server-feature-pack/src/main/resources/modules/system/layers/base/org/keycloak/keycloak-server-subsystem/main/server-war/WEB-INF/jboss-deployment-structure.xml b/distribution/feature-packs/server-feature-pack/src/main/resources/modules/system/layers/base/org/keycloak/keycloak-server-subsystem/main/server-war/WEB-INF/jboss-deployment-structure.xml index 936b532188..32cd209890 100755 --- a/distribution/feature-packs/server-feature-pack/src/main/resources/modules/system/layers/base/org/keycloak/keycloak-server-subsystem/main/server-war/WEB-INF/jboss-deployment-structure.xml +++ b/distribution/feature-packs/server-feature-pack/src/main/resources/modules/system/layers/base/org/keycloak/keycloak-server-subsystem/main/server-war/WEB-INF/jboss-deployment-structure.xml @@ -11,7 +11,6 @@ - diff --git a/distribution/feature-packs/server-feature-pack/src/main/resources/modules/system/layers/base/org/keycloak/keycloak-services/main/module.xml b/distribution/feature-packs/server-feature-pack/src/main/resources/modules/system/layers/base/org/keycloak/keycloak-services/main/module.xml index ee598198c0..122af6d077 100755 --- a/distribution/feature-packs/server-feature-pack/src/main/resources/modules/system/layers/base/org/keycloak/keycloak-services/main/module.xml +++ b/distribution/feature-packs/server-feature-pack/src/main/resources/modules/system/layers/base/org/keycloak/keycloak-services/main/module.xml @@ -21,7 +21,6 @@ - diff --git a/distribution/server-overlay/eap6/eap6-server-modules/build.xml b/distribution/server-overlay/eap6/eap6-server-modules/build.xml index d07ef7204e..3941fb99ac 100755 --- a/distribution/server-overlay/eap6/eap6-server-modules/build.xml +++ b/distribution/server-overlay/eap6/eap6-server-modules/build.xml @@ -63,10 +63,6 @@ - - - - diff --git a/distribution/server-overlay/eap6/eap6-server-modules/pom.xml b/distribution/server-overlay/eap6/eap6-server-modules/pom.xml index d5e0366c32..f9d5fc6b1b 100755 --- a/distribution/server-overlay/eap6/eap6-server-modules/pom.xml +++ b/distribution/server-overlay/eap6/eap6-server-modules/pom.xml @@ -30,10 +30,6 @@ org.keycloak keycloak-core - - org.keycloak - keycloak-core-jaxrs - org.keycloak keycloak-as7-server-subsystem diff --git a/distribution/server-overlay/eap6/eap6-server-modules/src/main/resources/modules/org/keycloak/keycloak-as7-server-subsystem/main/server-war/WEB-INF/jboss-deployment-structure.xml b/distribution/server-overlay/eap6/eap6-server-modules/src/main/resources/modules/org/keycloak/keycloak-as7-server-subsystem/main/server-war/WEB-INF/jboss-deployment-structure.xml index 936b532188..32cd209890 100755 --- a/distribution/server-overlay/eap6/eap6-server-modules/src/main/resources/modules/org/keycloak/keycloak-as7-server-subsystem/main/server-war/WEB-INF/jboss-deployment-structure.xml +++ b/distribution/server-overlay/eap6/eap6-server-modules/src/main/resources/modules/org/keycloak/keycloak-as7-server-subsystem/main/server-war/WEB-INF/jboss-deployment-structure.xml @@ -11,7 +11,6 @@ - diff --git a/distribution/server-overlay/eap6/eap6-server-modules/src/main/resources/modules/org/keycloak/keycloak-core-jaxrs/main/module.xml b/distribution/server-overlay/eap6/eap6-server-modules/src/main/resources/modules/org/keycloak/keycloak-core-jaxrs/main/module.xml deleted file mode 100755 index 36d2a7d402..0000000000 --- a/distribution/server-overlay/eap6/eap6-server-modules/src/main/resources/modules/org/keycloak/keycloak-core-jaxrs/main/module.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/distribution/server-overlay/eap6/eap6-server-modules/src/main/resources/modules/org/keycloak/keycloak-services/main/module.xml b/distribution/server-overlay/eap6/eap6-server-modules/src/main/resources/modules/org/keycloak/keycloak-services/main/module.xml index 807018d8be..75e1181eb7 100755 --- a/distribution/server-overlay/eap6/eap6-server-modules/src/main/resources/modules/org/keycloak/keycloak-services/main/module.xml +++ b/distribution/server-overlay/eap6/eap6-server-modules/src/main/resources/modules/org/keycloak/keycloak-services/main/module.xml @@ -21,7 +21,6 @@ - diff --git a/pom.xml b/pom.xml index 224a32346d..c2e2f41092 100755 --- a/pom.xml +++ b/pom.xml @@ -136,7 +136,6 @@ common core - core-jaxrs client-api connections dependencies @@ -656,11 +655,6 @@ keycloak-client-api ${project.version} - - org.keycloak - keycloak-core-jaxrs - ${project.version} - org.keycloak keycloak-events-api diff --git a/services/pom.xml b/services/pom.xml index 1e2e84e39c..0cbe349b83 100755 --- a/services/pom.xml +++ b/services/pom.xml @@ -30,10 +30,6 @@ org.keycloak keycloak-core - - org.keycloak - keycloak-core-jaxrs - org.keycloak keycloak-connections-http-client diff --git a/services/src/main/java/org/keycloak/services/resources/KeycloakApplication.java b/services/src/main/java/org/keycloak/services/resources/KeycloakApplication.java index 28818d8d0b..6ea2ecbdae 100755 --- a/services/src/main/java/org/keycloak/services/resources/KeycloakApplication.java +++ b/services/src/main/java/org/keycloak/services/resources/KeycloakApplication.java @@ -6,12 +6,12 @@ import org.jboss.logging.Logger; import org.jboss.resteasy.core.Dispatcher; import org.jboss.resteasy.spi.ResteasyProviderFactory; import org.keycloak.Config; -import org.keycloak.SkeletonKeyContextResolver; import org.keycloak.exportimport.ExportImportManager; import org.keycloak.migration.MigrationModelManager; import org.keycloak.models.KeycloakSession; import org.keycloak.models.KeycloakSessionFactory; import org.keycloak.models.RealmModel; +import org.keycloak.offlineconfig.AdminRecovery; import org.keycloak.representations.idm.RealmRepresentation; import org.keycloak.services.DefaultKeycloakSessionFactory; import org.keycloak.services.managers.ApplianceBootstrap; @@ -23,6 +23,7 @@ import org.keycloak.services.scheduled.ClearExpiredEvents; import org.keycloak.services.scheduled.ClearExpiredUserSessions; import org.keycloak.services.scheduled.ScheduledTaskRunner; import org.keycloak.services.util.JsonConfigProvider; +import org.keycloak.services.util.ObjectMapperResolver; import org.keycloak.timer.TimerProvider; import org.keycloak.util.JsonSerialization; import org.keycloak.util.SystemEnvProperties; @@ -31,18 +32,13 @@ import javax.servlet.ServletContext; import javax.ws.rs.core.Application; import javax.ws.rs.core.Context; import javax.ws.rs.core.UriInfo; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; +import java.io.*; import java.net.URI; import java.net.URL; import java.util.HashSet; import java.util.Properties; import java.util.Set; import java.util.StringTokenizer; -import org.keycloak.offlineconfig.AdminRecovery; /** * @author Bill Burke @@ -77,12 +73,12 @@ public class KeycloakApplication extends Application { singletons.add(new RealmsResource()); singletons.add(new AdminRoot()); singletons.add(new ModelExceptionMapper()); - classes.add(SkeletonKeyContextResolver.class); classes.add(QRCodeResource.class); classes.add(ThemeResource.class); classes.add(JsResource.class); classes.add(WelcomeResource.class); + singletons.add(new ObjectMapperResolver(Boolean.parseBoolean(System.getProperty("keycloak.jsonPrettyPrint", "false")))); setupDefaultRealm(context.getContextPath()); diff --git a/core-jaxrs/src/main/java/org/keycloak/SkeletonKeyContextResolver.java b/services/src/main/java/org/keycloak/services/util/ObjectMapperResolver.java similarity index 63% rename from core-jaxrs/src/main/java/org/keycloak/SkeletonKeyContextResolver.java rename to services/src/main/java/org/keycloak/services/util/ObjectMapperResolver.java index d17bfd2c19..4020098dd3 100755 --- a/core-jaxrs/src/main/java/org/keycloak/SkeletonKeyContextResolver.java +++ b/services/src/main/java/org/keycloak/services/util/ObjectMapperResolver.java @@ -1,4 +1,4 @@ -package org.keycloak; +package org.keycloak.services.util; import org.codehaus.jackson.map.ObjectMapper; import org.codehaus.jackson.map.SerializationConfig; @@ -14,24 +14,18 @@ import javax.ws.rs.ext.Provider; * @version $Revision: 1 $ */ @Provider -public class SkeletonKeyContextResolver implements ContextResolver { +public class ObjectMapperResolver implements ContextResolver { protected ObjectMapper mapper = new ObjectMapper(); - public SkeletonKeyContextResolver() { - mapper.setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL); - } - - public SkeletonKeyContextResolver(boolean indent) { + public ObjectMapperResolver(boolean indent) { mapper.setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL); if (indent) { mapper.enable(SerializationConfig.Feature.INDENT_OUTPUT); } } - @Override public ObjectMapper getContext(Class type) { - if (type.getPackage() != null && type.getPackage().getName().startsWith(getClass().getPackage().getName())) return mapper; - return null; + return mapper; } } diff --git a/testsuite/performance/pom.xml b/testsuite/performance/pom.xml index 0842cab726..b8871e4ad1 100755 --- a/testsuite/performance/pom.xml +++ b/testsuite/performance/pom.xml @@ -19,10 +19,6 @@ org.keycloak keycloak-core - - org.keycloak - keycloak-core-jaxrs - org.keycloak keycloak-services