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 a7f8a5d517..1f36f90661 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 @@ -133,7 +133,6 @@ module.controller('UserFederatedIdentityCtrl', function($scope, realm, user, fed $scope.realm = realm; $scope.user = user; $scope.federatedIdentities = federatedIdentities; - console.log('showing federated identities of user'); }); diff --git a/integration/admin-client/src/main/java/org/keycloak/admin/client/resource/UserResource.java b/integration/admin-client/src/main/java/org/keycloak/admin/client/resource/UserResource.java index 839ca23eba..34729386d8 100755 --- a/integration/admin-client/src/main/java/org/keycloak/admin/client/resource/UserResource.java +++ b/integration/admin-client/src/main/java/org/keycloak/admin/client/resource/UserResource.java @@ -54,16 +54,16 @@ public interface UserResource { public List getUserSessions(); @GET - @Path("social-links") - public List getSocialLinks(); + @Path("federated-identity") + public List getFederatedIdentity(); @POST - @Path("social-links/{provider}") - public Response addSocialLink(@PathParam("provider") String provider, FederatedIdentityRepresentation rep); + @Path("federated-identity/{provider}") + public Response addFederatedIdentity(@PathParam("provider") String provider, FederatedIdentityRepresentation rep); - @Path("social-links/{provider}") + @Path("federated-identity/{provider}") @DELETE - public void removeSocialLink(final @PathParam("provider") String provider); + public void removeFederatedIdentity(final @PathParam("provider") String provider); @Path("role-mappings") public RoleMappingResource roles(); diff --git a/services/src/main/java/org/keycloak/services/resources/admin/UsersResource.java b/services/src/main/java/org/keycloak/services/resources/admin/UsersResource.java index 28b443c549..fd353c8105 100755 --- a/services/src/main/java/org/keycloak/services/resources/admin/UsersResource.java +++ b/services/src/main/java/org/keycloak/services/resources/admin/UsersResource.java @@ -264,7 +264,7 @@ public class UsersResource { for (FederatedIdentityModel identity : identities) { for (IdentityProviderModel identityProviderModel : realm.getIdentityProviders()) { - if (identityProviderModel.getProviderId().equals(identity.getIdentityProvider())) { + if (identityProviderModel.getId().equals(identity.getIdentityProvider())) { FederatedIdentityRepresentation rep = ModelToRepresentation.toRepresentation(identity); rep.setIdentityProvider(identityProviderModel.getName()); @@ -276,10 +276,10 @@ public class UsersResource { return result; } - @Path("{username}/social-links/{provider}") + @Path("{username}/federated-identity/{provider}") @POST @NoCache - public Response addSocialLink(final @PathParam("username") String username, final @PathParam("provider") String provider, FederatedIdentityRepresentation rep) { + public Response addFederatedIdentity(final @PathParam("username") String username, final @PathParam("provider") String provider, FederatedIdentityRepresentation rep) { auth.requireManage(); UserModel user = session.users().getUserByUsername(username, realm); if (user == null) { @@ -295,10 +295,10 @@ public class UsersResource { return Response.noContent().build(); } - @Path("{username}/social-links/{provider}") + @Path("{username}/federated-identity/{provider}") @DELETE @NoCache - public void removeSocialLink(final @PathParam("username") String username, final @PathParam("provider") String provider) { + public void removeFederatedIdentity(final @PathParam("username") String username, final @PathParam("provider") String provider) { auth.requireManage(); UserModel user = session.users().getUserByUsername(username, realm); if (user == null) { diff --git a/testsuite/integration/src/test/java/org/keycloak/testsuite/admin/UserTest.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/admin/UserTest.java index b6710ee29c..41b577837a 100755 --- a/testsuite/integration/src/test/java/org/keycloak/testsuite/admin/UserTest.java +++ b/testsuite/integration/src/test/java/org/keycloak/testsuite/admin/UserTest.java @@ -114,7 +114,7 @@ public class UserTest extends AbstractClientTest { } @Test - public void addSocialLink() { + public void addFederatedIdentity() { createUser(); UserResource user = realm.users().get("user1"); @@ -123,19 +123,19 @@ public class UserTest extends AbstractClientTest { link.setUserId("social-user-id"); link.setUserName("social-username"); - Response response = user.addSocialLink("social-provider-id", link); + Response response = user.addFederatedIdentity("social-provider-id", link); assertEquals(204, response.getStatus()); } @Test @Ignore("Refactor based on KEYCLOAK-883") - public void getSocialLinks() { - addSocialLink(); + public void getFederatedIdentities() { + addFederatedIdentity(); UserResource user = realm.users().get("user1"); - assertEquals(1, user.getSocialLinks().size()); + assertEquals(1, user.getFederatedIdentity().size()); - FederatedIdentityRepresentation link = user.getSocialLinks().get(0); + FederatedIdentityRepresentation link = user.getFederatedIdentity().get(0); assertEquals("social-provider-id", link.getIdentityProvider()); assertEquals("social-user-id", link.getUserId()); assertEquals("social-username", link.getUserName()); @@ -143,15 +143,15 @@ public class UserTest extends AbstractClientTest { @Test @Ignore("Refactor based on KEYCLOAK-883") - public void removeSocialLink() { - addSocialLink(); + public void removeFederatedIdentity() { + addFederatedIdentity(); UserResource user = realm.users().get("user1"); - assertEquals(1, user.getSocialLinks().size()); + assertEquals(1, user.getFederatedIdentity().size()); - user.removeSocialLink("social-provider-id"); + user.removeFederatedIdentity("social-provider-id"); - assertEquals(0, user.getSocialLinks().size()); + assertEquals(0, user.getFederatedIdentity().size()); } @Test