From aca00dd42c25cd547e906d440a752410565865aa Mon Sep 17 00:00:00 2001 From: Marko Strukelj Date: Tue, 5 Jan 2016 23:06:26 +0100 Subject: [PATCH 1/5] Prevent ProviderFactories being loaded twice --- .../java/org/keycloak/provider/ProviderManager.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/services/src/main/java/org/keycloak/provider/ProviderManager.java b/services/src/main/java/org/keycloak/provider/ProviderManager.java index 6246d83973..3f250da672 100644 --- a/services/src/main/java/org/keycloak/provider/ProviderManager.java +++ b/services/src/main/java/org/keycloak/provider/ProviderManager.java @@ -3,6 +3,7 @@ package org.keycloak.provider; import org.jboss.logging.Logger; import java.util.HashMap; +import java.util.IdentityHashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -52,10 +53,17 @@ public class ProviderManager { List factories = cache.get(spi.getName()); if (factories == null) { factories = new LinkedList(); + IdentityHashMap factoryClasses = new IdentityHashMap(); for (ProviderLoader loader : loaders) { List f = loader.load(spi); if (f != null) { - factories.addAll(f); + for (ProviderFactory pf: f) { + // make sure there are no duplicates + if (!factoryClasses.containsKey(pf.getClass())) { + factories.add(pf); + factoryClasses.put(pf.getClass(), pf); + } + } } } } From 54712e29aa8b86aa883424ed9a3e22dfc507d381 Mon Sep 17 00:00:00 2001 From: mhajas Date: Tue, 22 Dec 2015 13:04:39 +0100 Subject: [PATCH 2/5] Use user script for admin user creating --- .../testsuite/AbstractKeycloakTest.java | 6 -- .../src/test/resources/keycloak-add-user.json | 16 ++++ .../integration-arquillian/tests/pom.xml | 76 +++++++++++++++++++ 3 files changed, 92 insertions(+), 6 deletions(-) create mode 100644 testsuite/integration-arquillian/tests/base/src/test/resources/keycloak-add-user.json diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/AbstractKeycloakTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/AbstractKeycloakTest.java index 13ec96e4d6..e74a646d6c 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/AbstractKeycloakTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/AbstractKeycloakTest.java @@ -90,12 +90,6 @@ public abstract class AbstractKeycloakTest { driverSettings(); - if (!suiteContext.isAdminPasswordUpdated()) { - log.debug("updating admin password"); - updateMasterAdminPassword(); - suiteContext.setAdminPasswordUpdated(true); - } - importTestRealms(); } diff --git a/testsuite/integration-arquillian/tests/base/src/test/resources/keycloak-add-user.json b/testsuite/integration-arquillian/tests/base/src/test/resources/keycloak-add-user.json new file mode 100644 index 0000000000..635f144a8e --- /dev/null +++ b/testsuite/integration-arquillian/tests/base/src/test/resources/keycloak-add-user.json @@ -0,0 +1,16 @@ +[ { + "realm" : "master", + "users" : [ { + "username" : "admin", + "enabled" : true, + "credentials" : [ { + "type" : "password", + "hashedSaltedValue" : "6K5rvcPu3dXndZOhpzLAVbFtcdlUhbGCrUyV0NNzeS61IdhMpjH8Mf4y/Ag/vHZkw4Ayvtvb9/1iMNOzxR0M6g==", + "salt" : "/6M1jTMUB0uR8EOkksFn/A==", + "hashIterations" : 100000, + "algorithm" : "pbkdf2" + } ], + "realmRoles" : [ "admin" ] + } ], + "identityFederationEnabled" : false +} ] \ No newline at end of file diff --git a/testsuite/integration-arquillian/tests/pom.xml b/testsuite/integration-arquillian/tests/pom.xml index bfac920ae3..a4c09e6100 100644 --- a/testsuite/integration-arquillian/tests/pom.xml +++ b/testsuite/integration-arquillian/tests/pom.xml @@ -91,6 +91,7 @@ ${auth.server.management.port.jmx} ${auth.server.ssl.required} ${startup.timeout.sec} + ${project.build.directory}/undertow-configuration @@ -127,6 +128,31 @@ + + maven-resources-plugin + 2.7 + + + copy-admin-user-json-file + process-resources + + copy-resources + + + ${project.build.directory}/undertow-configuration + + + src/test/resources + + keycloak-add-user.json + + true + + + + + + @@ -413,6 +439,31 @@ + + maven-resources-plugin + 2.7 + + + copy-admin-user-json-file + process-resources + + copy-resources + + + ${auth.server.wildfly.home}/standalone/configuration + + + src/test/resources + + keycloak-add-user.json + + true + + + + + + @@ -473,6 +524,31 @@ + + maven-resources-plugin + 2.7 + + + copy-admin-user-json-file + process-resources + + copy-resources + + + ${auth.server.eap6.home}/standalone/configuration + + + src/test/resources + + keycloak-add-user.json + + true + + + + + + From 65f5ce9f1340e287297b78080876db09a5e98368 Mon Sep 17 00:00:00 2001 From: Stian Thorgersen Date: Thu, 7 Jan 2016 13:09:53 +0100 Subject: [PATCH 3/5] KEYCLOAK-2252 Cannot delete client mapper with delete icon --- .../theme/base/admin/resources/js/controllers/clients.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/clients.js b/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/clients.js index 14243077af..b2d77ffcd1 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/clients.js +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/clients.js @@ -1627,7 +1627,7 @@ module.controller('ClientProtocolMapperCtrl', function($scope, realm, serverInfo }; $scope.remove = function() { - Dialog.confirmDelete($scope.mapper.name, 'mapper', function() { + Dialog.confirmDelete($scope.model.mapper.name, 'mapper', function() { ClientProtocolMapper.remove({ realm: realm.realm, client: client.id, id : $scope.model.mapper.id }, function() { Notifications.success("The mapper has been deleted."); $location.url("/realms/" + realm.realm + '/clients/' + client.id + "/mappers"); From 8695e169719929462855e63ae3707f0886555488 Mon Sep 17 00:00:00 2001 From: Stian Thorgersen Date: Thu, 7 Jan 2016 13:16:40 +0100 Subject: [PATCH 4/5] KEYCLOAK-2269 add-user script adds identityFederationEnabled field to keycloak-add-user.json --- .../keycloak/representations/idm/RealmRepresentation.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/core/src/main/java/org/keycloak/representations/idm/RealmRepresentation.java b/core/src/main/java/org/keycloak/representations/idm/RealmRepresentation.java index 3359f2195f..ed5fd9351e 100755 --- a/core/src/main/java/org/keycloak/representations/idm/RealmRepresentation.java +++ b/core/src/main/java/org/keycloak/representations/idm/RealmRepresentation.java @@ -642,11 +642,6 @@ public class RealmRepresentation { identityProviders.add(identityProviderRepresentation); } - @Deprecated - public boolean isIdentityFederationEnabled() { - return identityProviders != null && !identityProviders.isEmpty(); - } - public List getProtocolMappers() { return protocolMappers; } From 4b1b697aa352f40f6088aa94cb4701002d675ab3 Mon Sep 17 00:00:00 2001 From: Stian Thorgersen Date: Thu, 7 Jan 2016 16:19:59 +0100 Subject: [PATCH 5/5] KEYCLOAK-2127 Re-enable set admin user with welcome page --- .../java/org/keycloak/testsuite/AbstractKeycloakTest.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/AbstractKeycloakTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/AbstractKeycloakTest.java index e74a646d6c..13ec96e4d6 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/AbstractKeycloakTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/AbstractKeycloakTest.java @@ -90,6 +90,12 @@ public abstract class AbstractKeycloakTest { driverSettings(); + if (!suiteContext.isAdminPasswordUpdated()) { + log.debug("updating admin password"); + updateMasterAdminPassword(); + suiteContext.setAdminPasswordUpdated(true); + } + importTestRealms(); }