Merge pull request #573 from patriot1burke/master

fed ui
This commit is contained in:
Bill Burke 2014-07-31 13:14:45 -04:00
commit ce85a42ecf
26 changed files with 550 additions and 77 deletions

View file

@ -0,0 +1,46 @@
package org.keycloak.representations.idm;
import java.util.List;
import java.util.Map;
/**
* @author <a href="mailto:bburke@redhat.com">Bill Burke</a>
*/
public class UserFederationProviderFactoryRepresentation {
private String id;
private List<String> options;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public List<String> getOptions() {
return options;
}
public void setOptions(List<String> options) {
this.options = options;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
UserFederationProviderFactoryRepresentation that = (UserFederationProviderFactoryRepresentation) o;
if (!id.equals(that.id)) return false;
return true;
}
@Override
public int hashCode() {
return id.hashCode();
}
}

View file

@ -8,6 +8,7 @@ import java.util.Map;
public class UserFederationProviderRepresentation { public class UserFederationProviderRepresentation {
private String id; private String id;
private String displayName;
private String providerName; private String providerName;
private Map<String, String> config; private Map<String, String> config;
private int priority; private int priority;
@ -20,6 +21,14 @@ public class UserFederationProviderRepresentation {
this.id = id; this.id = id;
} }
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public String getProviderName() { public String getProviderName() {
return providerName; return providerName;
} }

View file

@ -7,6 +7,9 @@ import org.keycloak.models.UserFederationProviderModel;
import org.keycloak.models.KeycloakSession; import org.keycloak.models.KeycloakSession;
import org.picketlink.idm.PartitionManager; import org.picketlink.idm.PartitionManager;
import java.util.Collections;
import java.util.List;
/** /**
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a> * @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
* @version $Revision: 1 $ * @version $Revision: 1 $
@ -40,4 +43,9 @@ public class LDAPFederationProviderFactory implements UserFederationProviderFact
public String getId() { public String getId() {
return PROVIDER_NAME; return PROVIDER_NAME;
} }
@Override
public List<String> getConfigurationOptions() {
return Collections.emptyList();
}
} }

View file

@ -711,13 +711,13 @@ module.config([ '$routeProvider', function($routeProvider) {
}, },
controller : 'UserFederationCtrl' controller : 'UserFederationCtrl'
}) })
.when('/realms/:realm/user-federation/providers/ldap/:provider', { .when('/realms/:realm/user-federation/providers/ldap/:instance', {
templateUrl : 'partials/federated-ldap.html', templateUrl : 'partials/federated-ldap.html',
resolve : { resolve : {
realm : function(RealmLoader) { realm : function(RealmLoader) {
return RealmLoader(); return RealmLoader();
}, },
provider : function(UserFederationInstanceLoader) { instance : function(UserFederationInstanceLoader) {
return UserFederationInstanceLoader(); return UserFederationInstanceLoader();
} }
}, },
@ -729,22 +729,40 @@ module.config([ '$routeProvider', function($routeProvider) {
realm : function(RealmLoader) { realm : function(RealmLoader) {
return RealmLoader(); return RealmLoader();
}, },
provider : function() { instance : function() {
return {}; return {};
} }
}, },
controller : 'LDAPCtrl' controller : 'LDAPCtrl'
}) })
.when('/create/user-federation/:realm/providers/:provider', { .when('/create/user-federation/:realm/providers/:provider', {
templateUrl : 'partials/federated-ldap.html', templateUrl : 'partials/federated-generic.html',
resolve : { resolve : {
realm : function(RealmLoader) { realm : function(RealmLoader) {
return RealmLoader(); return RealmLoader();
}, },
provider : function() { instance : function() {
return { 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' controller : 'GenericUserFederationCtrl'

View file

@ -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.realm = realm;
$scope.user = angular.copy(user); $scope.user = angular.copy(user);
$scope.create = !user.username; $scope.create = !user.username;
if ($scope.create) { if ($scope.create) {
$scope.user.enabled = true; $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; $scope.changed = false; // $scope.create;
@ -338,31 +348,103 @@ module.controller('UserFederationCtrl', function($scope, $location, realm, UserF
$scope.providers = UserFederationProviders.query({realm: realm.realm}); $scope.providers = UserFederationProviders.query({realm: realm.realm});
$scope.addProvider = function(provider) { $scope.addProvider = function(provider) {
console.log('Add provider: ' + provider.name); console.log('Add provider: ' + provider.id);
$location.url("/create/user-federation/" + realm.realm + "/providers/" + provider.name); $location.url("/create/user-federation/" + realm.realm + "/providers/" + provider.id);
}; };
$scope.instances = UserFederationInstances.query({realm: realm.realm}); $scope.instances = UserFederationInstances.query({realm: realm.realm});
}); });
module.controller('GenericUserFederationCtrl', function($scope, realm, provider, UserFederationProviders, UserFederationInstances, Notifications, Dialog) { module.controller('GenericUserFederationCtrl', function($scope, $location, Notifications, Dialog, realm, instance, providerFactory, UserFederationInstances) {
console.log('GenericUserFederationCtrl'); console.log('GenericUserFederationCtrl');
console.log("provider: " + provider.providerName); $scope.instance = angular.copy(instance);
$scope.create = !instance.providerName;
$scope.providerFactory = providerFactory;
console.log("providerFactory: " + providerFactory.id);
if ($scope.create) {
$scope.instance.providerName = providerFactory.id;
$scope.instance.config = {};
$scope.instance.priority = 0;
}
$scope.realm = realm;
$scope.changed = false;
$scope.$watch('instance', function() {
if (!angular.equals($scope.instance, instance)) {
$scope.changed = true;
}
}, true);
$scope.save = function() {
$scope.changed = false;
if ($scope.create) {
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,
instance: instance.id
},
$scope.instance, function () {
$scope.changed = false;
$location.url("/realms/" + realm.realm + "/user-federation");
Notifications.success("The provider has been updated.");
});
}
};
$scope.reset = function() {
$scope.instance = angular.copy(instance);
if ($scope.create) {
$scope.instance.providerName = providerFactory.id;
$scope.instance.config = {};
$scope.instance.priority = 0;
}
$scope.changed = false;
};
$scope.cancel = function() {
$location.url("/realms/" + realm.realm + "/user-federation");
};
$scope.remove = function() {
Dialog.confirmDelete($scope.instance.id, 'provider', function() {
$scope.instance.$remove({
realm : realm.realm,
instance : $scope.instance.id
}, function() {
$location.url("/realms/" + realm.realm + "/user-federation");
Notifications.success("The provider has been deleted.");
});
});
};
}); });
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'); console.log('LDAPCtrl');
$scope.provider = angular.copy(provider); $scope.instance = angular.copy(instance);
$scope.create = !provider.providerName; $scope.create = !instance.providerName;
if ($scope.create) { if ($scope.create) {
$scope.provider.providerName = "ldap"; $scope.instance.providerName = "ldap";
$scope.provider.config = {}; $scope.instance.config = {};
$scope.instance.priority = 0;
} }
$scope.ldapVendors = [ $scope.ldapVendors = [
@ -380,23 +462,23 @@ module.controller('LDAPCtrl', function($scope, $location, Notifications, Dialog,
$scope.changed = false; $scope.changed = false;
$scope.lastVendor = $scope.provider.config.vendor; $scope.lastVendor = $scope.instance.config.vendor;
$scope.$watch('realm', function() { $scope.$watch('instance', function() {
if (!angular.equals($scope.provider, provider)) { if (!angular.equals($scope.instance, instance)) {
$scope.changed = true; $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"); console.log("LDAP vendor changed");
$scope.lastVendor = $scope.provider.config.vendor; $scope.lastVendor = $scope.instance.config.vendor;
if ($scope.lastVendor === "ad") { if ($scope.lastVendor === "ad") {
$scope.provider.config.usernameLDAPAttribute = "cn"; $scope.instance.config.usernameLDAPAttribute = "cn";
$scope.provider.config.userObjectClasses = "person, organizationalPerson"; $scope.instance.config.userObjectClasses = "person, organizationalPerson";
} else { } else {
$scope.provider.config.usernameLDAPAttribute = "uid"; $scope.instance.config.usernameLDAPAttribute = "uid";
$scope.provider.config.userObjectClasses = "inetOrgPerson, organizationalPerson"; $scope.instance.config.userObjectClasses = "inetOrgPerson, organizationalPerson";
} }
} }
}, true); }, true);
@ -404,16 +486,16 @@ module.controller('LDAPCtrl', function($scope, $location, Notifications, Dialog,
$scope.save = function() { $scope.save = function() {
$scope.changed = false; $scope.changed = false;
if ($scope.create) { if ($scope.create) {
UserFederationInstances.save({realm: realm.realm}, $scope.provider, function () { UserFederationInstances.save({realm: realm.realm}, $scope.instance, function () {
$scope.changed = false; $scope.changed = false;
$location.url("/realms/" + realm.realm + "/user-federation"); $location.url("/realms/" + realm.realm + "/user-federation");
Notifications.success("The provider has been created."); Notifications.success("The provider has been created.");
}); });
} else { } else {
UserFederationInstances.update({realm: realm.realm, UserFederationInstances.update({realm: realm.realm,
provider: provider.id instance: instance.id
}, },
$scope.provider, function () { $scope.instance, function () {
$scope.changed = false; $scope.changed = false;
$location.url("/realms/" + realm.realm + "/user-federation"); $location.url("/realms/" + realm.realm + "/user-federation");
Notifications.success("The provider has been updated."); Notifications.success("The provider has been updated.");
@ -423,13 +505,14 @@ module.controller('LDAPCtrl', function($scope, $location, Notifications, Dialog,
}; };
$scope.reset = function() { $scope.reset = function() {
$scope.provider = angular.copy(provider); $scope.instance = angular.copy(instance);
if ($scope.create) { if ($scope.create) {
$scope.provider.providerName = "ldap"; $scope.instance.providerName = "ldap";
$scope.provider.config = {}; $scope.instance.config = {};
$scope.instance.priority = 0;
} }
$scope.changed = false; $scope.changed = false;
$scope.lastVendor = $scope.provider.config.vendor; $scope.lastVendor = $scope.instance.config.vendor;
}; };
$scope.cancel = function() { $scope.cancel = function() {
@ -437,10 +520,10 @@ module.controller('LDAPCtrl', function($scope, $location, Notifications, Dialog,
}; };
$scope.remove = function() { $scope.remove = function() {
Dialog.confirmDelete($scope.provider.id, 'provider', function() { Dialog.confirmDelete($scope.instance.id, 'provider', function() {
$scope.provider.$remove({ $scope.instance.$remove({
realm : realm.realm, realm : realm.realm,
provider : $scope.provider.id instance : $scope.instance.id
}, function() { }, function() {
$location.url("/realms/" + realm.realm + "/user-federation"); $location.url("/realms/" + realm.realm + "/user-federation");
Notifications.success("The provider has been deleted."); Notifications.success("The provider has been deleted.");
@ -461,7 +544,7 @@ module.controller('LDAPCtrl', function($scope, $location, Notifications, Dialog,
$scope.testConnection = function() { $scope.testConnection = function() {
console.log('LDAPCtrl: testConnection'); 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."); Notifications.success("LDAP connection successful.");
}, function() { }, function() {
Notifications.error("Error when trying to connect to LDAP. See server.log for details."); Notifications.error("Error when trying to connect to LDAP. See server.log for details.");

View file

@ -90,6 +90,15 @@ module.factory('UserLoader', function(Loader, User, $route, $q) {
module.factory('UserFederationInstanceLoader', function(Loader, UserFederationInstances, $route, $q) { module.factory('UserFederationInstanceLoader', function(Loader, UserFederationInstances, $route, $q) {
return Loader.get(UserFederationInstances, function() { 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 { return {
realm : $route.current.params.realm, realm : $route.current.params.realm,
provider: $route.current.params.provider provider: $route.current.params.provider

View file

@ -200,9 +200,9 @@ module.factory('User', function($resource) {
}); });
module.factory('UserFederationInstances', 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', realm : '@realm',
provider : '@provider' instance : '@instance'
}, { }, {
update : { update : {
method : 'PUT' method : 'PUT'
@ -211,8 +211,9 @@ module.factory('UserFederationInstances', function($resource) {
}); });
module.factory('UserFederationProviders', function($resource) { module.factory('UserFederationProviders', function($resource) {
return $resource(authUrl + '/admin/realms/:realm/user-federation/providers', { return $resource(authUrl + '/admin/realms/:realm/user-federation/providers/:provider', {
realm : '@realm' realm : '@realm',
provider : "@provider"
}); });
}); });

View file

@ -11,6 +11,48 @@
</ol> </ol>
<h2 class="pull-left"><span>{{realm.realm}}</span> Provider Settings</h2> <h2 class="pull-left"><span>{{realm.realm}}</span> Provider Settings</h2>
<p class="subtitle"><span class="required">*</span> Required fields</p> <p class="subtitle"><span class="required">*</span> Required fields</p>
<form class="form-horizontal" name="realmForm" novalidate kc-read-only="!access.manageRealm">
<fieldset>
<legend><span class="text">Required Settings</span></legend>
<div class="form-group clearfix" data-ng-show="!create">
<label class="col-sm-2 control-label" for="providerId">Provider ID </label>
<div class="col-sm-4">
<input class="form-control" id="providerId" type="text" ng-model="instance.id" readonly>
</div>
</div>
<div class="form-group clearfix">
<label class="col-sm-2 control-label" for="consoleDisplayName">Console display name </label>
<div class="col-sm-4">
<input class="form-control" id="consoleDisplayName" type="text" ng-model="instance.displayName" placeholder="defaults to id">
</div>
</div>
<div class="form-group clearfix">
<label class="col-sm-2 control-label" for="priority">Priority </label>
<div class="col-sm-4">
<input class="form-control" id="priority" type="text" ng-model="instance.priority">
</div>
</div>
<div data-ng-repeat="option in providerFactory.options" class="form-group">
<label class="col-sm-2 control-label">{{option|capitalize}} </label>
<div class="col-sm-4">
<input class="form-control" type="text" data-ng-model="instance.config[ option ]" >
</div>
</div>
</fieldset>
<div class="pull-right form-actions" data-ng-show="create && access.manageUsers">
<button kc-cancel data-ng-click="cancel()">Cancel</button>
<button kc-save data-ng-show="changed">Save</button>
</div>
<div class="pull-right form-actions" data-ng-show="!create && access.manageUsers">
<button kc-reset data-ng-show="changed">Clear changes</button>
<button kc-save data-ng-show="changed">Save</button>
<button kc-delete data-ng-click="remove()" data-ng-hide="changed">Delete</button>
</div>
</form>
</div> </div>
</div> </div>

View file

@ -15,12 +15,30 @@
<fieldset> <fieldset>
<legend><span class="text">Required Settings</span></legend> <legend><span class="text">Required Settings</span></legend>
<div class="form-group clearfix" data-ng-show="!create">
<label class="col-sm-2 control-label" for="providerId">Provider ID </label>
<div class="col-sm-4">
<input class="form-control" id="providerId" type="text" ng-model="instance.id" readonly>
</div>
</div>
<div class="form-group clearfix">
<label class="col-sm-2 control-label" for="consoleDisplayName">Console display name </label>
<div class="col-sm-4">
<input class="form-control" id="consoleDisplayName" type="text" ng-model="instance.displayName" placeholder="defaults to id">
</div>
</div>
<div class="form-group clearfix">
<label class="col-sm-2 control-label" for="priority">Priority </label>
<div class="col-sm-4">
<input class="form-control" id="priority" type="text" ng-model="instance.priority">
</div>
</div>
<div class="form-group clearfix"> <div class="form-group clearfix">
<label class="col-sm-2 control-label" for="vendor">Vendor</label> <label class="col-sm-2 control-label" for="vendor">Vendor</label>
<div class="col-sm-4"> <div class="col-sm-4">
<div class="select-kc"> <div class="select-kc">
<select id="vendor" <select id="vendor"
ng-model="provider.config.vendor" ng-model="instance.config.vendor"
ng-options="vendor.id as vendor.name for vendor in ldapVendors"> ng-options="vendor.id as vendor.name for vendor in ldapVendors">
</select> </select>
</div> </div>
@ -31,7 +49,7 @@
<div class="col-sm-4"> <div class="col-sm-4">
<div class="select-kc"> <div class="select-kc">
<select id="usernameLDAPAttribute" <select id="usernameLDAPAttribute"
ng-model="provider.config.usernameLDAPAttribute" ng-model="instance.config.usernameLDAPAttribute"
ng-options="usernameLDAPAttribute for usernameLDAPAttribute in usernameLDAPAttributes"> ng-options="usernameLDAPAttribute for usernameLDAPAttribute in usernameLDAPAttributes">
</select> </select>
</div> </div>
@ -40,13 +58,13 @@
<div class="form-group clearfix"> <div class="form-group clearfix">
<label class="col-sm-2 control-label" for="userObjectClasses">User Object Classes </label> <label class="col-sm-2 control-label" for="userObjectClasses">User Object Classes </label>
<div class="col-sm-4"> <div class="col-sm-4">
<input class="form-control" id="userObjectClasses" type="text" ng-model="provider.config.userObjectClasses" placeholder="LDAP User Object Classes (div. by comma)"> <input class="form-control" id="userObjectClasses" type="text" ng-model="instance.config.userObjectClasses" placeholder="LDAP User Object Classes (div. by comma)">
</div> </div>
</div> </div>
<div class="form-group clearfix"> <div class="form-group clearfix">
<label class="col-sm-2 control-label" for="ldapConnectionUrl">Connection URL <span class="required">*</span></label> <label class="col-sm-2 control-label" for="ldapConnectionUrl">Connection URL <span class="required">*</span></label>
<div class="col-sm-4"> <div class="col-sm-4">
<input class="form-control" id="ldapConnectionUrl" type="text" ng-model="provider.config.connectionUrl" placeholder="LDAP connection URL" required> <input class="form-control" id="ldapConnectionUrl" type="text" ng-model="instance.config.connectionUrl" placeholder="LDAP connection URL" required>
</div> </div>
<div class="col-sm-4" data-ng-show="access.manageRealm"> <div class="col-sm-4" data-ng-show="access.manageRealm">
<a class="btn btn-primary" data-ng-click="testConnection()">Test connection</a> <a class="btn btn-primary" data-ng-click="testConnection()">Test connection</a>
@ -55,25 +73,25 @@
<div class="form-group clearfix"> <div class="form-group clearfix">
<label class="col-sm-2 control-label" for="ldapBaseDn">Base DN <span class="required">*</span></label> <label class="col-sm-2 control-label" for="ldapBaseDn">Base DN <span class="required">*</span></label>
<div class="col-sm-4"> <div class="col-sm-4">
<input class="form-control" id="ldapBaseDn" type="text" ng-model="provider.config.baseDn" placeholder="LDAP Base DN" required> <input class="form-control" id="ldapBaseDn" type="text" ng-model="instance.config.baseDn" placeholder="LDAP Base DN" required>
</div> </div>
</div> </div>
<div class="form-group clearfix"> <div class="form-group clearfix">
<label class="col-sm-2 control-label" for="ldapUserDnSuffix">User DN Suffix <span class="required">*</span></label> <label class="col-sm-2 control-label" for="ldapUserDnSuffix">User DN Suffix <span class="required">*</span></label>
<div class="col-sm-4"> <div class="col-sm-4">
<input class="form-control" id="ldapUserDnSuffix" type="text" ng-model="provider.config.userDnSuffix" placeholder="LDAP User DN Suffix" required> <input class="form-control" id="ldapUserDnSuffix" type="text" ng-model="instance.config.userDnSuffix" placeholder="LDAP User DN Suffix" required>
</div> </div>
</div> </div>
<div class="form-group clearfix"> <div class="form-group clearfix">
<label class="col-sm-2 control-label" for="ldapBindDn">Bind DN <span class="required">*</span></label> <label class="col-sm-2 control-label" for="ldapBindDn">Bind DN <span class="required">*</span></label>
<div class="col-sm-4"> <div class="col-sm-4">
<input class="form-control" id="ldapBindDn" type="text" ng-model="provider.config.bindDn" placeholder="LDAP Bind DN" required> <input class="form-control" id="ldapBindDn" type="text" ng-model="instance.config.bindDn" placeholder="LDAP Bind DN" required>
</div> </div>
</div> </div>
<div class="form-group clearfix"> <div class="form-group clearfix">
<label class="col-sm-2 control-label" for="ldapBindCredential">Bind Credential <span class="required">*</span></label> <label class="col-sm-2 control-label" for="ldapBindCredential">Bind Credential <span class="required">*</span></label>
<div class="col-sm-4"> <div class="col-sm-4">
<input class="form-control" id="ldapBindCredential" type="text" ng-model="provider.config.bindCredential" placeholder="LDAP Bind Credentials" required> <input class="form-control" id="ldapBindCredential" type="text" ng-model="instance.config.bindCredential" placeholder="LDAP Bind Credentials" required>
</div> </div>
<div class="col-sm-4" data-ng-show="access.manageRealm"> <div class="col-sm-4" data-ng-show="access.manageRealm">
<a class="btn btn-primary" data-ng-click="testAuthentication()">Test authentication</a> <a class="btn btn-primary" data-ng-click="testAuthentication()">Test authentication</a>

View file

@ -75,6 +75,12 @@
<input ng-model="user.enabled" name="userEnabled" id="userEnabled" onoffswitch /> <input ng-model="user.enabled" name="userEnabled" id="userEnabled" onoffswitch />
</div> </div>
</div> </div>
<div class="form-group clearfix block" data-ng-show="!create && user.federationLink">
<label class="col-sm-2 control-label" for="userEnabled">Federation Link</label>
<div class="col-sm-4">
<a href="{{federationLink}}">{{federationLinkName}}</a>
</div>
</div>
<div class="form-group clearfix block"> <div class="form-group clearfix block">
<label class="col-sm-2 control-label" for="emailVerified">Email verified</label> <label class="col-sm-2 control-label" for="emailVerified">Email verified</label>
<div class="col-sm-4"> <div class="col-sm-4">

View file

@ -18,7 +18,7 @@
<div class="pull-right"> <div class="pull-right">
<div class="select-kc"> <div class="select-kc">
<select ng-model="selectedProvider" <select ng-model="selectedProvider"
ng-options="p.name for p in providers" ng-options="p.id for p in providers"
data-ng-change="addProvider(selectedProvider); selectedProvider = null"> data-ng-change="addProvider(selectedProvider); selectedProvider = null">
<option value="" disabled selected>Add provider...</option> <option value="" disabled selected>Add provider...</option>
</select> </select>
@ -34,7 +34,7 @@
</thead> </thead>
<tbody> <tbody>
<tr ng-repeat="instance in instances"> <tr ng-repeat="instance in instances">
<td><a href="#/realms/{{realm.realm}}/user-federation/providers/{{instance.providerName}}/{{instance.id}}">{{instance.id}}</a></td> <td><a href="#/realms/{{realm.realm}}/user-federation/providers/{{instance.providerName}}/{{instance.id}}">{{instance.displayName}}</a></td>
<td>{{instance.providerName|capitalize}}</td> <td>{{instance.providerName|capitalize}}</td>
<td>{{instance.priority}}</td> <td>{{instance.priority}}</td>
</tr> </tr>

View file

@ -167,7 +167,7 @@ public interface RealmModel extends RoleContainerModel {
List<UserFederationProviderModel> getUserFederationProviders(); List<UserFederationProviderModel> getUserFederationProviders();
UserFederationProviderModel addUserFederationProvider(String providerName, Map<String, String> config, int priority); UserFederationProviderModel addUserFederationProvider(String providerName, Map<String, String> config, int priority, String displayName);
void updateUserFederationProvider(UserFederationProviderModel provider); void updateUserFederationProvider(UserFederationProviderModel provider);
void removeUserFederationProvider(UserFederationProviderModel provider); void removeUserFederationProvider(UserFederationProviderModel provider);
void setUserFederationProviders(List<UserFederationProviderModel> providers); void setUserFederationProviders(List<UserFederationProviderModel> providers);

View file

@ -2,10 +2,13 @@ package org.keycloak.models;
import org.keycloak.provider.ProviderFactory; import org.keycloak.provider.ProviderFactory;
import java.util.List;
/** /**
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a> * @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
* @version $Revision: 1 $ * @version $Revision: 1 $
*/ */
public interface UserFederationProviderFactory extends ProviderFactory<UserFederationProvider> { public interface UserFederationProviderFactory extends ProviderFactory<UserFederationProvider> {
UserFederationProvider getInstance(KeycloakSession session, UserFederationProviderModel model); UserFederationProvider getInstance(KeycloakSession session, UserFederationProviderModel model);
List<String> getConfigurationOptions();
} }

View file

@ -13,15 +13,18 @@ public class UserFederationProviderModel {
private String providerName; private String providerName;
private Map<String, String> config = new HashMap<String, String>(); private Map<String, String> config = new HashMap<String, String>();
private int priority; private int priority;
private String displayName;
public UserFederationProviderModel() {}; public UserFederationProviderModel() {};
public UserFederationProviderModel(String id, String providerName, Map<String, String> config, int priority) { public UserFederationProviderModel(String id, String providerName, Map<String, String> config, int priority, String displayName) {
this.id = id; this.id = id;
this.providerName = providerName; this.providerName = providerName;
if (config != null) { if (config != null) {
this.config.putAll(config); this.config.putAll(config);
} }
this.priority = priority;
this.displayName = displayName;
} }
public String getId() { public String getId() {
@ -51,4 +54,12 @@ public class UserFederationProviderModel {
public void setPriority(int priority) { public void setPriority(int priority) {
this.priority = priority; this.priority = priority;
} }
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
} }

View file

@ -11,6 +11,7 @@ public class UserFederationProviderEntity {
protected String providerName; protected String providerName;
protected Map<String, String> config; protected Map<String, String> config;
protected int priority; protected int priority;
protected String displayName;
public String getId() { public String getId() {
@ -44,4 +45,12 @@ public class UserFederationProviderEntity {
public void setPriority(int priority) { public void setPriority(int priority) {
this.priority = priority; this.priority = priority;
} }
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
} }

View file

@ -51,6 +51,7 @@ public class ModelToRepresentation {
rep.setEnabled(user.isEnabled()); rep.setEnabled(user.isEnabled());
rep.setEmailVerified(user.isEmailVerified()); rep.setEmailVerified(user.isEmailVerified());
rep.setTotp(user.isTotp()); rep.setTotp(user.isTotp());
rep.setFederationLink(user.getFederationLink());
List<String> reqActions = new ArrayList<String>(); List<String> reqActions = new ArrayList<String>();
for (UserModel.RequiredAction ra : user.getRequiredActions()){ for (UserModel.RequiredAction ra : user.getRequiredActions()){
@ -276,6 +277,7 @@ public class ModelToRepresentation {
rep.setConfig(model.getConfig()); rep.setConfig(model.getConfig());
rep.setProviderName(model.getProviderName()); rep.setProviderName(model.getProviderName());
rep.setPriority(model.getPriority()); rep.setPriority(model.getPriority());
rep.setDisplayName(model.getDisplayName());
return rep; return rep;
} }
} }

View file

@ -320,7 +320,7 @@ public class RepresentationToModel {
for (UserFederationProviderRepresentation representation : providers) { for (UserFederationProviderRepresentation representation : providers) {
UserFederationProviderModel model = new UserFederationProviderModel(representation.getId(), representation.getProviderName(), UserFederationProviderModel model = new UserFederationProviderModel(representation.getId(), representation.getProviderName(),
representation.getConfig(), representation.getPriority()); representation.getConfig(), representation.getPriority(), representation.getDisplayName());
result.add(model); result.add(model);
} }
return result; return result;

View file

@ -618,9 +618,9 @@ public class RealmAdapter implements RealmModel {
} }
@Override @Override
public UserFederationProviderModel addUserFederationProvider(String providerName, Map<String, String> config, int priority) { public UserFederationProviderModel addUserFederationProvider(String providerName, Map<String, String> config, int priority, String displayName) {
getDelegateForUpdate(); getDelegateForUpdate();
return updated.addUserFederationProvider(providerName, config, priority); return updated.addUserFederationProvider(providerName, config, priority, displayName);
} }
@Override @Override

View file

@ -746,14 +746,14 @@ public class RealmAdapter implements RealmModel {
}); });
List<UserFederationProviderModel> result = new ArrayList<UserFederationProviderModel>(); List<UserFederationProviderModel> result = new ArrayList<UserFederationProviderModel>();
for (UserFederationProviderEntity entity : copy) { for (UserFederationProviderEntity entity : copy) {
result.add(new UserFederationProviderModel(entity.getId(), entity.getProviderName(), entity.getConfig(), entity.getPriority())); result.add(new UserFederationProviderModel(entity.getId(), entity.getProviderName(), entity.getConfig(), entity.getPriority(), entity.getDisplayName()));
} }
return result; return result;
} }
@Override @Override
public UserFederationProviderModel addUserFederationProvider(String providerName, Map<String, String> config, int priority) { public UserFederationProviderModel addUserFederationProvider(String providerName, Map<String, String> config, int priority, String displayName) {
String id = KeycloakModelUtils.generateId(); String id = KeycloakModelUtils.generateId();
UserFederationProviderEntity entity = new UserFederationProviderEntity(); UserFederationProviderEntity entity = new UserFederationProviderEntity();
entity.setId(id); entity.setId(id);
@ -761,10 +761,14 @@ public class RealmAdapter implements RealmModel {
entity.setProviderName(providerName); entity.setProviderName(providerName);
entity.setConfig(config); entity.setConfig(config);
entity.setPriority(priority); entity.setPriority(priority);
if (displayName == null) {
displayName = id;
}
entity.setDisplayName(displayName);
em.persist(entity); em.persist(entity);
realm.getUserFederationProviders().add(entity); realm.getUserFederationProviders().add(entity);
em.flush(); em.flush();
return new UserFederationProviderModel(entity.getId(), providerName, config, priority); return new UserFederationProviderModel(entity.getId(), providerName, config, priority, displayName);
} }
@Override @Override
@ -785,6 +789,10 @@ public class RealmAdapter implements RealmModel {
while (it.hasNext()) { while (it.hasNext()) {
UserFederationProviderEntity entity = it.next(); UserFederationProviderEntity entity = it.next();
if (entity.getId().equals(model.getId())) { if (entity.getId().equals(model.getId())) {
String displayName = model.getDisplayName();
if (displayName != null) {
entity.setDisplayName(model.getDisplayName());
}
entity.setConfig(model.getConfig()); entity.setConfig(model.getConfig());
entity.setPriority(model.getPriority()); entity.setPriority(model.getPriority());
entity.setProviderName(model.getProviderName()); entity.setProviderName(model.getProviderName());
@ -807,6 +815,10 @@ public class RealmAdapter implements RealmModel {
entity.setPriority(model.getPriority()); entity.setPriority(model.getPriority());
entity.setProviderName(model.getProviderName()); entity.setProviderName(model.getProviderName());
entity.setPriority(model.getPriority()); entity.setPriority(model.getPriority());
String displayName = model.getDisplayName();
if (displayName != null) {
entity.setDisplayName(model.getDisplayName());
}
found = true; found = true;
break; break;
} }
@ -829,7 +841,7 @@ public class RealmAdapter implements RealmModel {
if (!found) add.add(model); if (!found) add.add(model);
} }
for (UserFederationProviderModel model : providers) { for (UserFederationProviderModel model : add) {
UserFederationProviderEntity entity = new UserFederationProviderEntity(); UserFederationProviderEntity entity = new UserFederationProviderEntity();
if (model.getId() != null) entity.setId(model.getId()); if (model.getId() != null) entity.setId(model.getId());
else entity.setId(KeycloakModelUtils.generateId()); else entity.setId(KeycloakModelUtils.generateId());
@ -837,6 +849,10 @@ public class RealmAdapter implements RealmModel {
entity.setPriority(model.getPriority()); entity.setPriority(model.getPriority());
entity.setProviderName(model.getProviderName()); entity.setProviderName(model.getProviderName());
entity.setPriority(model.getPriority()); entity.setPriority(model.getPriority());
String displayName = model.getDisplayName();
if (displayName == null) {
entity.setDisplayName(entity.getId());
}
em.persist(entity); em.persist(entity);
realm.getUserFederationProviders().add(entity); realm.getUserFederationProviders().add(entity);

View file

@ -41,6 +41,9 @@ public class UserFederationProviderEntity {
@CollectionTable(name="USER_FEDERATION_CONFIG") @CollectionTable(name="USER_FEDERATION_CONFIG")
private Map<String, String> config; private Map<String, String> config;
@Column(name="DISPLAY_NAME")
private String displayName;
public String getId() { public String getId() {
return id; return id;
} }
@ -81,5 +84,11 @@ public class UserFederationProviderEntity {
this.config = config; this.config = config;
} }
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
} }

View file

@ -795,16 +795,19 @@ public class RealmAdapter extends AbstractMongoAdapter<MongoRealmEntity> impleme
} }
@Override @Override
public UserFederationProviderModel addUserFederationProvider(String providerName, Map<String, String> config, int priority) { public UserFederationProviderModel addUserFederationProvider(String providerName, Map<String, String> config, int priority, String displayName) {
UserFederationProviderEntity entity = new UserFederationProviderEntity(); UserFederationProviderEntity entity = new UserFederationProviderEntity();
entity.setId(KeycloakModelUtils.generateId()); entity.setId(KeycloakModelUtils.generateId());
entity.setPriority(priority); entity.setPriority(priority);
entity.setProviderName(providerName); entity.setProviderName(providerName);
entity.setConfig(config); entity.setConfig(config);
if (displayName == null) {
displayName = entity.getId();
}
realm.getUserFederationProviders().add(entity); realm.getUserFederationProviders().add(entity);
updateRealm(); updateRealm();
return new UserFederationProviderModel(entity.getId(), providerName, config, priority); return new UserFederationProviderModel(entity.getId(), providerName, config, priority, displayName);
} }
@Override @Override
@ -828,6 +831,10 @@ public class RealmAdapter extends AbstractMongoAdapter<MongoRealmEntity> impleme
entity.setProviderName(model.getProviderName()); entity.setProviderName(model.getProviderName());
entity.setConfig(model.getConfig()); entity.setConfig(model.getConfig());
entity.setPriority(model.getPriority()); entity.setPriority(model.getPriority());
String displayName = model.getDisplayName();
if (displayName != null) {
entity.setDisplayName(model.getDisplayName());
}
} }
} }
updateRealm(); updateRealm();
@ -851,7 +858,7 @@ public class RealmAdapter extends AbstractMongoAdapter<MongoRealmEntity> impleme
}); });
List<UserFederationProviderModel> result = new LinkedList<UserFederationProviderModel>(); List<UserFederationProviderModel> result = new LinkedList<UserFederationProviderModel>();
for (UserFederationProviderEntity entity : copy) { for (UserFederationProviderEntity entity : copy) {
result.add(new UserFederationProviderModel(entity.getId(), entity.getProviderName(), entity.getConfig(), entity.getPriority())); result.add(new UserFederationProviderModel(entity.getId(), entity.getProviderName(), entity.getConfig(), entity.getPriority(), entity.getDisplayName()));
} }
return result; return result;
@ -867,6 +874,10 @@ public class RealmAdapter extends AbstractMongoAdapter<MongoRealmEntity> impleme
entity.setProviderName(model.getProviderName()); entity.setProviderName(model.getProviderName());
entity.setConfig(model.getConfig()); entity.setConfig(model.getConfig());
entity.setPriority(model.getPriority()); entity.setPriority(model.getPriority());
String displayName = model.getDisplayName();
if (displayName == null) {
entity.setDisplayName(entity.getId());
}
entities.add(entity); entities.add(entity);
} }

View file

@ -16,8 +16,10 @@ import org.keycloak.models.RoleModel;
import org.keycloak.models.SocialLinkModel; import org.keycloak.models.SocialLinkModel;
import org.keycloak.models.UserCredentialModel; import org.keycloak.models.UserCredentialModel;
import org.keycloak.models.UserFederationProvider; import org.keycloak.models.UserFederationProvider;
import org.keycloak.models.UserFederationProviderFactory;
import org.keycloak.models.UserFederationProviderModel; import org.keycloak.models.UserFederationProviderModel;
import org.keycloak.models.UserModel; import org.keycloak.models.UserModel;
import org.keycloak.models.UserProviderFactory;
import org.keycloak.models.UserSessionModel; import org.keycloak.models.UserSessionModel;
import org.keycloak.models.utils.ModelToRepresentation; import org.keycloak.models.utils.ModelToRepresentation;
import org.keycloak.models.utils.RepresentationToModel; 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.MappingsRepresentation;
import org.keycloak.representations.idm.RoleRepresentation; import org.keycloak.representations.idm.RoleRepresentation;
import org.keycloak.representations.idm.SocialLinkRepresentation; import org.keycloak.representations.idm.SocialLinkRepresentation;
import org.keycloak.representations.idm.UserFederationProviderFactoryRepresentation;
import org.keycloak.representations.idm.UserFederationProviderRepresentation; import org.keycloak.representations.idm.UserFederationProviderRepresentation;
import org.keycloak.representations.idm.UserRepresentation; import org.keycloak.representations.idm.UserRepresentation;
import org.keycloak.representations.idm.UserSessionRepresentation; import org.keycloak.representations.idm.UserSessionRepresentation;
@ -96,19 +99,43 @@ public class UserFederationResource {
@GET @GET
@Path("providers") @Path("providers")
@Produces("application/json") @Produces("application/json")
public List<Map<String, String>> getProviders() { public List<UserFederationProviderFactoryRepresentation> getProviders() {
logger.info("get provider list"); logger.info("get provider list");
auth.requireView(); auth.requireView();
List<Map<String, String>> providers = new LinkedList<Map<String, String>>(); List<UserFederationProviderFactoryRepresentation> providers = new LinkedList<UserFederationProviderFactoryRepresentation>();
for (ProviderFactory factory : session.getKeycloakSessionFactory().getProviderFactories(UserFederationProvider.class)) { for (ProviderFactory factory : session.getKeycloakSessionFactory().getProviderFactories(UserFederationProvider.class)) {
Map<String, String> provider = new HashMap<String, String>(); UserFederationProviderFactoryRepresentation rep = new UserFederationProviderFactoryRepresentation();
provider.put("name", factory.getId()); rep.setId(factory.getId());
providers.add(provider); rep.setOptions(((UserFederationProviderFactory)factory).getConfigurationOptions());
providers.add(rep);
} }
logger.info("provider list.size() " + providers.size()); logger.info("provider list.size() " + providers.size());
return providers; 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 * Create a provider
* *
@ -118,10 +145,14 @@ public class UserFederationResource {
@POST @POST
@Path("instances") @Path("instances")
@Consumes("application/json") @Consumes("application/json")
public Response createProvider(UserFederationProviderRepresentation rep) { public Response createProviderInstance(UserFederationProviderRepresentation rep) {
logger.info("createProvider"); logger.info("createProvider");
auth.requireManage(); auth.requireManage();
UserFederationProviderModel model = realm.addUserFederationProvider(rep.getProviderName(), rep.getConfig(), rep.getPriority()); String displayName = rep.getDisplayName();
if (displayName != null && displayName.trim().equals("")) {
displayName = null;
}
UserFederationProviderModel model = realm.addUserFederationProvider(rep.getProviderName(), rep.getConfig(), rep.getPriority(), displayName);
return Response.created(uriInfo.getAbsolutePathBuilder().path(model.getId()).build()).build(); return Response.created(uriInfo.getAbsolutePathBuilder().path(model.getId()).build()).build();
} }
@ -134,10 +165,14 @@ public class UserFederationResource {
@PUT @PUT
@Path("instances/{id}") @Path("instances/{id}")
@Consumes("application/json") @Consumes("application/json")
public void updateProvider(@PathParam("id") String id, UserFederationProviderRepresentation rep) { public void updateProviderInstance(@PathParam("id") String id, UserFederationProviderRepresentation rep) {
logger.info("updateProvider"); logger.info("updateProvider");
auth.requireManage(); auth.requireManage();
UserFederationProviderModel model = new UserFederationProviderModel(id, rep.getProviderName(), rep.getConfig(), rep.getPriority()); String displayName = rep.getDisplayName();
if (displayName != null && displayName.trim().equals("")) {
displayName = null;
}
UserFederationProviderModel model = new UserFederationProviderModel(id, rep.getProviderName(), rep.getConfig(), rep.getPriority(), displayName);
realm.updateUserFederationProvider(model); realm.updateUserFederationProvider(model);
} }
@ -149,7 +184,7 @@ public class UserFederationResource {
@GET @GET
@Path("instances/{id}") @Path("instances/{id}")
@Consumes("application/json") @Consumes("application/json")
public UserFederationProviderRepresentation getProvider(@PathParam("id") String id) { public UserFederationProviderRepresentation getProviderInstance(@PathParam("id") String id) {
logger.info("getProvider"); logger.info("getProvider");
auth.requireView(); auth.requireView();
for (UserFederationProviderModel model : realm.getUserFederationProviders()) { for (UserFederationProviderModel model : realm.getUserFederationProviders()) {
@ -167,10 +202,10 @@ public class UserFederationResource {
*/ */
@DELETE @DELETE
@Path("instances/{id}") @Path("instances/{id}")
public void deleteProvider(@PathParam("id") String id) { public void deleteProviderInstance(@PathParam("id") String id) {
logger.info("deleteProvider"); logger.info("deleteProvider");
auth.requireManage(); auth.requireManage();
UserFederationProviderModel model = new UserFederationProviderModel(id, null, null, -1); UserFederationProviderModel model = new UserFederationProviderModel(id, null, null, -1, null);
realm.removeUserFederationProvider(model); realm.removeUserFederationProvider(model);
} }
@ -184,8 +219,8 @@ public class UserFederationResource {
@GET @GET
@Path("instances") @Path("instances")
@Produces("application/json") @Produces("application/json")
public List<UserFederationProviderRepresentation> getUserFederationProviders() { public List<UserFederationProviderRepresentation> getUserFederationInstances() {
logger.info("getUserFederationProviders"); logger.info("getUserFederationInstances");
auth.requireManage(); auth.requireManage();
List<UserFederationProviderRepresentation> reps = new LinkedList<UserFederationProviderRepresentation>(); List<UserFederationProviderRepresentation> reps = new LinkedList<UserFederationProviderRepresentation>();
for (UserFederationProviderModel model : realm.getUserFederationProviders()) { for (UserFederationProviderModel model : realm.getUserFederationProviders()) {

View file

@ -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 <a href="mailto:bill@burkecentral.com">Bill Burke</a>
* @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<UserModel> searchByAttributes(Map<String, String> 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<String> getSupportedCredentialTypes() {
return Collections.emptySet();
}
@Override
public boolean validCredentials(RealmModel realm, UserModel user, List<UserCredentialModel> input) {
return false;
}
@Override
public boolean validCredentials(RealmModel realm, UserModel user, UserCredentialModel... input) {
return false;
}
@Override
public void close() {
}
}

View file

@ -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 <a href="mailto:bill@burkecentral.com">Bill Burke</a>
* @version $Revision: 1 $
*/
public class DummyUserFederationProviderFactory implements UserFederationProviderFactory {
@Override
public UserFederationProvider getInstance(KeycloakSession session, UserFederationProviderModel model) {
return new DummyUserFederationProvider();
}
@Override
public List<String> getConfigurationOptions() {
List<String> list = new ArrayList<String>();
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";
}
}

View file

@ -0,0 +1 @@
org.keycloak.testutils.DummyUserFederationProviderFactory

View file

@ -64,7 +64,7 @@ public class FederationProvidersIntegrationTest {
appRealm.addUserFederationProvider(LDAPFederationProviderFactory.PROVIDER_NAME, ldapConfig, 0); appRealm.addUserFederationProvider(LDAPFederationProviderFactory.PROVIDER_NAME, ldapConfig, 0, null);
// Configure LDAP // Configure LDAP
ldapRule.getEmbeddedServer().setupLdapInRealm(appRealm); ldapRule.getEmbeddedServer().setupLdapInRealm(appRealm);