Use firstName, lastName in KeyCloakImpl
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/d37c9d2f Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/d37c9d2f Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/d37c9d2f Branch: refs/heads/master Commit: d37c9d2ff004bf51caee598d3513d0c936839089 Parents: 9fab627 Author: Gourav Shenoy <[email protected]> Authored: Tue May 2 16:00:55 2017 -0400 Committer: Gourav Shenoy <[email protected]> Committed: Tue May 2 16:00:55 2017 -0400 ---------------------------------------------------------------------- .../services/core/impl/TenantManagementKeycloakImpl.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/d37c9d2f/airavata-services/profile-service/iam-admin-services-core/src/main/java/org/apache/airavata/service/profile/iam/admin/services/core/impl/TenantManagementKeycloakImpl.java ---------------------------------------------------------------------- diff --git a/airavata-services/profile-service/iam-admin-services-core/src/main/java/org/apache/airavata/service/profile/iam/admin/services/core/impl/TenantManagementKeycloakImpl.java b/airavata-services/profile-service/iam-admin-services-core/src/main/java/org/apache/airavata/service/profile/iam/admin/services/core/impl/TenantManagementKeycloakImpl.java index 5f4b417..d385b70 100644 --- a/airavata-services/profile-service/iam-admin-services-core/src/main/java/org/apache/airavata/service/profile/iam/admin/services/core/impl/TenantManagementKeycloakImpl.java +++ b/airavata-services/profile-service/iam-admin-services-core/src/main/java/org/apache/airavata/service/profile/iam/admin/services/core/impl/TenantManagementKeycloakImpl.java @@ -216,8 +216,8 @@ public class TenantManagementKeycloakImpl implements TenantManagementInterface { Keycloak client = TenantManagementKeycloakImpl.getClient(ServerSettings.getIamServerUrl(), userProfile.getGatewayId(), realmAdminCreds); UserRepresentation user = new UserRepresentation(); user.setUsername(userProfile.getUserId()); - //ToDo: userProfile donot have firstname and lastname, putting Full name in keycloak's firstname field. - user.setFirstName(userProfile.getUserName()); + user.setFirstName(userProfile.getFirstName()); + user.setLastName(userProfile.getLastName()); // Always takes the first value List<String> emails = userProfile.getEmails(); user.setEmail(emails.get(0)); @@ -272,8 +272,8 @@ public class TenantManagementKeycloakImpl implements TenantManagementInterface { try{ Keycloak client = TenantManagementKeycloakImpl.getClient(ServerSettings.getIamServerUrl(), userProfile.getGatewayId(), realmAdminCreds); List<UserRepresentation> retrieveUserList = client.realm(userProfile.getGatewayId()).users().search(userProfile.getUserId(), - userProfile.getUserName(), - null, + userProfile.getFirstName(), + userProfile.getLastName(), userProfile.getEmails().get(0), 0, 1); if(!retrieveUserList.isEmpty())
