diff --git a/federation/ldap/src/main/java/org/keycloak/federation/ldap/LDAPFederationProviderFactory.java b/federation/ldap/src/main/java/org/keycloak/federation/ldap/LDAPFederationProviderFactory.java index b656d7ac26..155c2a0d66 100755 --- a/federation/ldap/src/main/java/org/keycloak/federation/ldap/LDAPFederationProviderFactory.java +++ b/federation/ldap/src/main/java/org/keycloak/federation/ldap/LDAPFederationProviderFactory.java @@ -7,6 +7,9 @@ import org.keycloak.models.UserFederationProviderModel; import org.keycloak.models.KeycloakSession; import org.picketlink.idm.PartitionManager; +import java.util.Collections; +import java.util.List; + /** * @author Bill Burke * @version $Revision: 1 $ @@ -40,4 +43,9 @@ public class LDAPFederationProviderFactory implements UserFederationProviderFact public String getId() { return PROVIDER_NAME; } + + @Override + public List getConfigurationOptions() { + return Collections.emptyList(); + } } diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/js/app.js b/forms/common-themes/src/main/resources/theme/admin/base/resources/js/app.js index 937bad7df3..94970f4dda 100755 --- a/forms/common-themes/src/main/resources/theme/admin/base/resources/js/app.js +++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/js/app.js @@ -711,13 +711,13 @@ module.config([ '$routeProvider', function($routeProvider) { }, controller : 'UserFederationCtrl' }) - .when('/realms/:realm/user-federation/providers/ldap/:provider', { + .when('/realms/:realm/user-federation/providers/ldap/:instance', { templateUrl : 'partials/federated-ldap.html', resolve : { realm : function(RealmLoader) { return RealmLoader(); }, - provider : function(UserFederationInstanceLoader) { + instance : function(UserFederationInstanceLoader) { return UserFederationInstanceLoader(); } }, @@ -729,22 +729,40 @@ module.config([ '$routeProvider', function($routeProvider) { realm : function(RealmLoader) { return RealmLoader(); }, - provider : function() { + instance : function() { return {}; } }, controller : 'LDAPCtrl' }) .when('/create/user-federation/:realm/providers/:provider', { - templateUrl : 'partials/federated-ldap.html', + templateUrl : 'partials/federated-generic.html', resolve : { realm : function(RealmLoader) { return RealmLoader(); }, - provider : function() { + instance : function() { return { - providerName: "@provider" + }; + }, + providerFactory : function(UserFederationFactoryLoader) { + return UserFederationFactoryLoader(); + } + }, + controller : 'GenericUserFederationCtrl' + }) + .when('/realms/:realm/user-federation/providers/:provider/:instance', { + templateUrl : 'partials/federated-generic.html', + resolve : { + realm : function(RealmLoader) { + return RealmLoader(); + }, + instance : function(UserFederationInstanceLoader) { + return UserFederationInstanceLoader(); + }, + providerFactory : function(UserFederationFactoryLoader) { + return UserFederationFactoryLoader(); } }, controller : 'GenericUserFederationCtrl' diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/js/controllers/users.js b/forms/common-themes/src/main/resources/theme/admin/base/resources/js/controllers/users.js index 034d52b326..0161019b13 100755 --- a/forms/common-themes/src/main/resources/theme/admin/base/resources/js/controllers/users.js +++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/js/controllers/users.js @@ -176,13 +176,23 @@ module.controller('UserListCtrl', function($scope, realm, User) { -module.controller('UserDetailCtrl', function($scope, realm, user, User, $location, Dialog, Notifications) { +module.controller('UserDetailCtrl', function($scope, realm, user, User, UserFederationInstances, $location, Dialog, Notifications) { $scope.realm = realm; $scope.user = angular.copy(user); $scope.create = !user.username; if ($scope.create) { $scope.user.enabled = true; + } else { + if(user.federationLink) { + console.log("federationLink is not null"); + UserFederationInstances.get({realm : realm.realm, instance: user.federationLink}, function(link) { + $scope.federationLinkName = link.displayName; + $scope.federationLink = "#/realms/" + realm.realm + "/user-federation/providers/" + link.providerName + "/" + link.id; + }) + } else { + console.log("federationLink is null"); + } } $scope.changed = false; // $scope.create; @@ -338,24 +348,27 @@ module.controller('UserFederationCtrl', function($scope, $location, realm, UserF $scope.providers = UserFederationProviders.query({realm: realm.realm}); $scope.addProvider = function(provider) { - console.log('Add provider: ' + provider.name); - $location.url("/create/user-federation/" + realm.realm + "/providers/" + provider.name); + console.log('Add provider: ' + provider.id); + $location.url("/create/user-federation/" + realm.realm + "/providers/" + provider.id); }; $scope.instances = UserFederationInstances.query({realm: realm.realm}); }); -module.controller('GenericUserFederationCtrl', function($scope, $location, Notifications, Dialog, realm, provider, providerFactory, UserFederationInstances) { +module.controller('GenericUserFederationCtrl', function($scope, $location, Notifications, Dialog, realm, instance, providerFactory, UserFederationInstances) { console.log('GenericUserFederationCtrl'); - $scope.provider = angular.copy(provider); - $scope.create = !provider.providerName; + $scope.instance = angular.copy(instance); + $scope.create = !instance.providerName; + $scope.providerFactory = providerFactory; + + console.log("providerFactory: " + providerFactory.id); if ($scope.create) { - $scope.provider.providerName = providerFactory.id; - $scope.provider.config = {}; - $scope.provider.priority = 0; + $scope.instance.providerName = providerFactory.id; + $scope.instance.config = {}; + $scope.instance.priority = 0; } $scope.realm = realm; @@ -363,8 +376,8 @@ module.controller('GenericUserFederationCtrl', function($scope, $location, Notif $scope.changed = false; - $scope.$watch('provider', function() { - if (!angular.equals($scope.provider, provider)) { + $scope.$watch('instance', function() { + if (!angular.equals($scope.instance, instance)) { $scope.changed = true; } @@ -373,16 +386,16 @@ module.controller('GenericUserFederationCtrl', function($scope, $location, Notif $scope.save = function() { $scope.changed = false; if ($scope.create) { - UserFederationInstances.save({realm: realm.realm}, $scope.provider, function () { + UserFederationInstances.save({realm: realm.realm}, $scope.instance, function () { $scope.changed = false; $location.url("/realms/" + realm.realm + "/user-federation"); Notifications.success("The provider has been created."); }); } else { UserFederationInstances.update({realm: realm.realm, - provider: provider.id + instance: instance.id }, - $scope.provider, function () { + $scope.instance, function () { $scope.changed = false; $location.url("/realms/" + realm.realm + "/user-federation"); Notifications.success("The provider has been updated."); @@ -392,11 +405,11 @@ module.controller('GenericUserFederationCtrl', function($scope, $location, Notif }; $scope.reset = function() { - $scope.provider = angular.copy(provider); + $scope.instance = angular.copy(instance); if ($scope.create) { - $scope.provider.providerName = providerFactory.id; - $scope.provider.config = {}; - $scope.provider.priority = 0; + $scope.instance.providerName = providerFactory.id; + $scope.instance.config = {}; + $scope.instance.priority = 0; } $scope.changed = false; }; @@ -406,10 +419,10 @@ module.controller('GenericUserFederationCtrl', function($scope, $location, Notif }; $scope.remove = function() { - Dialog.confirmDelete($scope.provider.id, 'provider', function() { - $scope.provider.$remove({ + Dialog.confirmDelete($scope.instance.id, 'provider', function() { + $scope.instance.$remove({ realm : realm.realm, - provider : $scope.provider.id + instance : $scope.instance.id }, function() { $location.url("/realms/" + realm.realm + "/user-federation"); Notifications.success("The provider has been deleted."); @@ -422,16 +435,16 @@ module.controller('GenericUserFederationCtrl', function($scope, $location, Notif -module.controller('LDAPCtrl', function($scope, $location, Notifications, Dialog, realm, provider, UserFederationInstances, RealmLDAPConnectionTester) { +module.controller('LDAPCtrl', function($scope, $location, Notifications, Dialog, realm, instance, UserFederationInstances, RealmLDAPConnectionTester) { console.log('LDAPCtrl'); - $scope.provider = angular.copy(provider); - $scope.create = !provider.providerName; + $scope.instance = angular.copy(instance); + $scope.create = !instance.providerName; if ($scope.create) { - $scope.provider.providerName = "ldap"; - $scope.provider.config = {}; - $scope.provider.priority = 0; + $scope.instance.providerName = "ldap"; + $scope.instance.config = {}; + $scope.instance.priority = 0; } $scope.ldapVendors = [ @@ -449,23 +462,23 @@ module.controller('LDAPCtrl', function($scope, $location, Notifications, Dialog, $scope.changed = false; - $scope.lastVendor = $scope.provider.config.vendor; + $scope.lastVendor = $scope.instance.config.vendor; - $scope.$watch('provider', function() { - if (!angular.equals($scope.provider, provider)) { + $scope.$watch('instance', function() { + if (!angular.equals($scope.instance, instance)) { $scope.changed = true; } - if (!angular.equals($scope.provider.config.vendor, $scope.lastVendor)) { + if (!angular.equals($scope.instance.config.vendor, $scope.lastVendor)) { console.log("LDAP vendor changed"); - $scope.lastVendor = $scope.provider.config.vendor; + $scope.lastVendor = $scope.instance.config.vendor; if ($scope.lastVendor === "ad") { - $scope.provider.config.usernameLDAPAttribute = "cn"; - $scope.provider.config.userObjectClasses = "person, organizationalPerson"; + $scope.instance.config.usernameLDAPAttribute = "cn"; + $scope.instance.config.userObjectClasses = "person, organizationalPerson"; } else { - $scope.provider.config.usernameLDAPAttribute = "uid"; - $scope.provider.config.userObjectClasses = "inetOrgPerson, organizationalPerson"; + $scope.instance.config.usernameLDAPAttribute = "uid"; + $scope.instance.config.userObjectClasses = "inetOrgPerson, organizationalPerson"; } } }, true); @@ -473,16 +486,16 @@ module.controller('LDAPCtrl', function($scope, $location, Notifications, Dialog, $scope.save = function() { $scope.changed = false; if ($scope.create) { - UserFederationInstances.save({realm: realm.realm}, $scope.provider, function () { + UserFederationInstances.save({realm: realm.realm}, $scope.instance, function () { $scope.changed = false; $location.url("/realms/" + realm.realm + "/user-federation"); Notifications.success("The provider has been created."); }); } else { UserFederationInstances.update({realm: realm.realm, - provider: provider.id + instance: instance.id }, - $scope.provider, function () { + $scope.instance, function () { $scope.changed = false; $location.url("/realms/" + realm.realm + "/user-federation"); Notifications.success("The provider has been updated."); @@ -492,14 +505,14 @@ module.controller('LDAPCtrl', function($scope, $location, Notifications, Dialog, }; $scope.reset = function() { - $scope.provider = angular.copy(provider); + $scope.instance = angular.copy(instance); if ($scope.create) { - $scope.provider.providerName = "ldap"; - $scope.provider.config = {}; - $scope.provider.priority = 0; + $scope.instance.providerName = "ldap"; + $scope.instance.config = {}; + $scope.instance.priority = 0; } $scope.changed = false; - $scope.lastVendor = $scope.provider.config.vendor; + $scope.lastVendor = $scope.instance.config.vendor; }; $scope.cancel = function() { @@ -507,10 +520,10 @@ module.controller('LDAPCtrl', function($scope, $location, Notifications, Dialog, }; $scope.remove = function() { - Dialog.confirmDelete($scope.provider.id, 'provider', function() { - $scope.provider.$remove({ + Dialog.confirmDelete($scope.instance.id, 'provider', function() { + $scope.instance.$remove({ realm : realm.realm, - provider : $scope.provider.id + instance : $scope.instance.id }, function() { $location.url("/realms/" + realm.realm + "/user-federation"); Notifications.success("The provider has been deleted."); @@ -531,7 +544,7 @@ module.controller('LDAPCtrl', function($scope, $location, Notifications, Dialog, $scope.testConnection = function() { console.log('LDAPCtrl: testConnection'); - RealmLDAPConnectionTester.get(initConnectionTest("testConnection", $scope.provider.config), function() { + RealmLDAPConnectionTester.get(initConnectionTest("testConnection", $scope.instance.config), function() { Notifications.success("LDAP connection successful."); }, function() { Notifications.error("Error when trying to connect to LDAP. See server.log for details."); diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/js/loaders.js b/forms/common-themes/src/main/resources/theme/admin/base/resources/js/loaders.js index f18f1c2c42..987d8c765c 100755 --- a/forms/common-themes/src/main/resources/theme/admin/base/resources/js/loaders.js +++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/js/loaders.js @@ -90,6 +90,15 @@ module.factory('UserLoader', function(Loader, User, $route, $q) { module.factory('UserFederationInstanceLoader', function(Loader, UserFederationInstances, $route, $q) { return Loader.get(UserFederationInstances, function() { + return { + realm : $route.current.params.realm, + instance: $route.current.params.instance + } + }); +}); + +module.factory('UserFederationFactoryLoader', function(Loader, UserFederationProviders, $route, $q) { + return Loader.get(UserFederationProviders, function() { return { realm : $route.current.params.realm, provider: $route.current.params.provider diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/js/services.js b/forms/common-themes/src/main/resources/theme/admin/base/resources/js/services.js index 6ea04fde83..e8af6643ec 100755 --- a/forms/common-themes/src/main/resources/theme/admin/base/resources/js/services.js +++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/js/services.js @@ -200,9 +200,9 @@ module.factory('User', function($resource) { }); module.factory('UserFederationInstances', function($resource) { - return $resource(authUrl + '/admin/realms/:realm/user-federation/instances/:provider', { + return $resource(authUrl + '/admin/realms/:realm/user-federation/instances/:instance', { realm : '@realm', - provider : '@provider' + instance : '@instance' }, { update : { method : 'PUT' @@ -211,8 +211,9 @@ module.factory('UserFederationInstances', function($resource) { }); module.factory('UserFederationProviders', function($resource) { - return $resource(authUrl + '/admin/realms/:realm/user-federation/providers', { - realm : '@realm' + return $resource(authUrl + '/admin/realms/:realm/user-federation/providers/:provider', { + realm : '@realm', + provider : "@provider" }); }); diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/federated-generic.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/federated-generic.html index 775f8f86f4..0bb813bb0e 100755 --- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/federated-generic.html +++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/federated-generic.html @@ -11,6 +11,48 @@

{{realm.realm}} Provider Settings

* Required fields

+
+
+ Required Settings +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ + +
+ +
+
+ +
+ +
+ + +
+ +
+ + + +
+
\ No newline at end of file diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/federated-ldap.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/federated-ldap.html index edcf14173c..9916be562e 100755 --- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/federated-ldap.html +++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/federated-ldap.html @@ -15,16 +15,22 @@
Required Settings +
+ +
+ +
+
- +
- +
@@ -32,7 +38,7 @@
@@ -43,7 +49,7 @@
@@ -52,13 +58,13 @@
- +
- +
Test connection @@ -67,25 +73,25 @@
- +
- +
- +
- +
Test authentication diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-detail.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-detail.html index 6238039326..d99c518d49 100755 --- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-detail.html +++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-detail.html @@ -75,6 +75,12 @@
+
+ + +
diff --git a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-federation.html b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-federation.html index 352f526b64..aad2d4b6e0 100755 --- a/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-federation.html +++ b/forms/common-themes/src/main/resources/theme/admin/base/resources/partials/user-federation.html @@ -18,7 +18,7 @@
diff --git a/model/api/src/main/java/org/keycloak/models/UserFederationProviderFactory.java b/model/api/src/main/java/org/keycloak/models/UserFederationProviderFactory.java index b723f3dd74..7b3c38835a 100755 --- a/model/api/src/main/java/org/keycloak/models/UserFederationProviderFactory.java +++ b/model/api/src/main/java/org/keycloak/models/UserFederationProviderFactory.java @@ -2,10 +2,13 @@ package org.keycloak.models; import org.keycloak.provider.ProviderFactory; +import java.util.List; + /** * @author Bill Burke * @version $Revision: 1 $ */ public interface UserFederationProviderFactory extends ProviderFactory { UserFederationProvider getInstance(KeycloakSession session, UserFederationProviderModel model); + List getConfigurationOptions(); } diff --git a/model/api/src/main/java/org/keycloak/models/utils/ModelToRepresentation.java b/model/api/src/main/java/org/keycloak/models/utils/ModelToRepresentation.java index 21765a347c..ec0c8442ba 100755 --- a/model/api/src/main/java/org/keycloak/models/utils/ModelToRepresentation.java +++ b/model/api/src/main/java/org/keycloak/models/utils/ModelToRepresentation.java @@ -51,6 +51,7 @@ public class ModelToRepresentation { rep.setEnabled(user.isEnabled()); rep.setEmailVerified(user.isEmailVerified()); rep.setTotp(user.isTotp()); + rep.setFederationLink(user.getFederationLink()); List reqActions = new ArrayList(); for (UserModel.RequiredAction ra : user.getRequiredActions()){ diff --git a/services/src/main/java/org/keycloak/services/resources/admin/UserFederationResource.java b/services/src/main/java/org/keycloak/services/resources/admin/UserFederationResource.java index 7e7a0b27ac..e947b1ed6b 100755 --- a/services/src/main/java/org/keycloak/services/resources/admin/UserFederationResource.java +++ b/services/src/main/java/org/keycloak/services/resources/admin/UserFederationResource.java @@ -16,8 +16,10 @@ import org.keycloak.models.RoleModel; import org.keycloak.models.SocialLinkModel; import org.keycloak.models.UserCredentialModel; import org.keycloak.models.UserFederationProvider; +import org.keycloak.models.UserFederationProviderFactory; import org.keycloak.models.UserFederationProviderModel; import org.keycloak.models.UserModel; +import org.keycloak.models.UserProviderFactory; import org.keycloak.models.UserSessionModel; import org.keycloak.models.utils.ModelToRepresentation; import org.keycloak.models.utils.RepresentationToModel; @@ -28,6 +30,7 @@ import org.keycloak.representations.idm.CredentialRepresentation; import org.keycloak.representations.idm.MappingsRepresentation; import org.keycloak.representations.idm.RoleRepresentation; import org.keycloak.representations.idm.SocialLinkRepresentation; +import org.keycloak.representations.idm.UserFederationProviderFactoryRepresentation; import org.keycloak.representations.idm.UserFederationProviderRepresentation; import org.keycloak.representations.idm.UserRepresentation; import org.keycloak.representations.idm.UserSessionRepresentation; @@ -96,19 +99,43 @@ public class UserFederationResource { @GET @Path("providers") @Produces("application/json") - public List> getProviders() { + public List getProviders() { logger.info("get provider list"); auth.requireView(); - List> providers = new LinkedList>(); + List providers = new LinkedList(); for (ProviderFactory factory : session.getKeycloakSessionFactory().getProviderFactories(UserFederationProvider.class)) { - Map provider = new HashMap(); - provider.put("name", factory.getId()); - providers.add(provider); + UserFederationProviderFactoryRepresentation rep = new UserFederationProviderFactoryRepresentation(); + rep.setId(factory.getId()); + rep.setOptions(((UserFederationProviderFactory)factory).getConfigurationOptions()); + providers.add(rep); } logger.info("provider list.size() " + providers.size()); return providers; } + /** + * Get List of available provider factories + * + * @return + */ + @GET + @Path("providers/{id}") + @Produces("application/json") + public UserFederationProviderFactoryRepresentation getProvider(@PathParam("id") String id) { + logger.info("get provider list"); + auth.requireView(); + for (ProviderFactory factory : session.getKeycloakSessionFactory().getProviderFactories(UserFederationProvider.class)) { + if (!factory.getId().equals(id)) { + continue; + } + UserFederationProviderFactoryRepresentation rep = new UserFederationProviderFactoryRepresentation(); + rep.setId(factory.getId()); + rep.setOptions(((UserFederationProviderFactory)factory).getConfigurationOptions()); + return rep; + } + throw new NotFoundException("Could not find provider"); + } + /** * Create a provider * @@ -118,7 +145,7 @@ public class UserFederationResource { @POST @Path("instances") @Consumes("application/json") - public Response createProvider(UserFederationProviderRepresentation rep) { + public Response createProviderInstance(UserFederationProviderRepresentation rep) { logger.info("createProvider"); auth.requireManage(); String displayName = rep.getDisplayName(); @@ -138,7 +165,7 @@ public class UserFederationResource { @PUT @Path("instances/{id}") @Consumes("application/json") - public void updateProvider(@PathParam("id") String id, UserFederationProviderRepresentation rep) { + public void updateProviderInstance(@PathParam("id") String id, UserFederationProviderRepresentation rep) { logger.info("updateProvider"); auth.requireManage(); String displayName = rep.getDisplayName(); @@ -157,7 +184,7 @@ public class UserFederationResource { @GET @Path("instances/{id}") @Consumes("application/json") - public UserFederationProviderRepresentation getProvider(@PathParam("id") String id) { + public UserFederationProviderRepresentation getProviderInstance(@PathParam("id") String id) { logger.info("getProvider"); auth.requireView(); for (UserFederationProviderModel model : realm.getUserFederationProviders()) { @@ -175,7 +202,7 @@ public class UserFederationResource { */ @DELETE @Path("instances/{id}") - public void deleteProvider(@PathParam("id") String id) { + public void deleteProviderInstance(@PathParam("id") String id) { logger.info("deleteProvider"); auth.requireManage(); UserFederationProviderModel model = new UserFederationProviderModel(id, null, null, -1, null); @@ -192,8 +219,8 @@ public class UserFederationResource { @GET @Path("instances") @Produces("application/json") - public List getUserFederationProviders() { - logger.info("getUserFederationProviders"); + public List getUserFederationInstances() { + logger.info("getUserFederationInstances"); auth.requireManage(); List reps = new LinkedList(); for (UserFederationProviderModel model : realm.getUserFederationProviders()) { diff --git a/testsuite/integration/src/main/java/org/keycloak/testutils/DummyUserFederationProvider.java b/testsuite/integration/src/main/java/org/keycloak/testutils/DummyUserFederationProvider.java new file mode 100755 index 0000000000..5d2c36b738 --- /dev/null +++ b/testsuite/integration/src/main/java/org/keycloak/testutils/DummyUserFederationProvider.java @@ -0,0 +1,88 @@ +package org.keycloak.testutils; + +import org.keycloak.models.RealmModel; +import org.keycloak.models.RoleModel; +import org.keycloak.models.UserCredentialModel; +import org.keycloak.models.UserFederationProvider; +import org.keycloak.models.UserModel; + +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * @author Bill Burke + * @version $Revision: 1 $ + */ +public class DummyUserFederationProvider implements UserFederationProvider { + @Override + public UserModel proxy(UserModel local) { + return local; + } + + @Override + public boolean isRegistrationSupported() { + return false; + } + + @Override + public UserModel register(RealmModel realm, UserModel user) { + return user; + } + + @Override + public boolean removeUser(RealmModel realm, UserModel user) { + return true; + } + + @Override + public UserModel getUserByUsername(RealmModel realm, String username) { + return null; + } + + @Override + public UserModel getUserByEmail(RealmModel realm, String email) { + return null; + } + + @Override + public List searchByAttributes(Map attributes, RealmModel realm) { + return Collections.emptyList(); + } + + @Override + public void preRemove(RealmModel realm) { + + } + + @Override + public void preRemove(RealmModel realm, RoleModel role) { + + } + + @Override + public boolean isValid(UserModel local) { + return false; + } + + @Override + public Set getSupportedCredentialTypes() { + return Collections.emptySet(); + } + + @Override + public boolean validCredentials(RealmModel realm, UserModel user, List input) { + return false; + } + + @Override + public boolean validCredentials(RealmModel realm, UserModel user, UserCredentialModel... input) { + return false; + } + + @Override + public void close() { + + } +} diff --git a/testsuite/integration/src/main/java/org/keycloak/testutils/DummyUserFederationProviderFactory.java b/testsuite/integration/src/main/java/org/keycloak/testutils/DummyUserFederationProviderFactory.java new file mode 100755 index 0000000000..2314a67482 --- /dev/null +++ b/testsuite/integration/src/main/java/org/keycloak/testutils/DummyUserFederationProviderFactory.java @@ -0,0 +1,48 @@ +package org.keycloak.testutils; + +import org.keycloak.Config; +import org.keycloak.models.KeycloakSession; +import org.keycloak.models.UserFederationProvider; +import org.keycloak.models.UserFederationProviderFactory; +import org.keycloak.models.UserFederationProviderModel; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author Bill Burke + * @version $Revision: 1 $ + */ +public class DummyUserFederationProviderFactory implements UserFederationProviderFactory { + @Override + public UserFederationProvider getInstance(KeycloakSession session, UserFederationProviderModel model) { + return new DummyUserFederationProvider(); + } + + @Override + public List getConfigurationOptions() { + List list = new ArrayList(); + list.add("important.config"); + return list; + } + + @Override + public UserFederationProvider create(KeycloakSession session) { + return new DummyUserFederationProvider(); + } + + @Override + public void init(Config.Scope config) { + + } + + @Override + public void close() { + + } + + @Override + public String getId() { + return "dummy"; + } +} diff --git a/testsuite/integration/src/main/resources/META-INF/services/org.keycloak.models.UserFederationProviderFactory b/testsuite/integration/src/main/resources/META-INF/services/org.keycloak.models.UserFederationProviderFactory new file mode 100755 index 0000000000..82b852c8e0 --- /dev/null +++ b/testsuite/integration/src/main/resources/META-INF/services/org.keycloak.models.UserFederationProviderFactory @@ -0,0 +1 @@ +org.keycloak.testutils.DummyUserFederationProviderFactory \ No newline at end of file