diff --git a/gateway/src/main/java/org/georchestra/gateway/accounts/events/rabbitmq/RabbitmqAccountCreatedEventSender.java b/gateway/src/main/java/org/georchestra/gateway/accounts/events/rabbitmq/RabbitmqAccountCreatedEventSender.java index a12e987f..6f853ce6 100644 --- a/gateway/src/main/java/org/georchestra/gateway/accounts/events/rabbitmq/RabbitmqAccountCreatedEventSender.java +++ b/gateway/src/main/java/org/georchestra/gateway/accounts/events/rabbitmq/RabbitmqAccountCreatedEventSender.java @@ -47,19 +47,28 @@ public void on(AccountCreated event) { final String oAuth2ProviderId = user.getOAuth2ProviderId(); if (null != oAuth2ProviderId) { String fullName = user.getFirstName() + " " + user.getLastName(); + String localUid = user.getUsername(); String email = user.getEmail(); String organization = user.getOrganization(); String[] providerFields = oAuth2ProviderId.split(";"); - sendNewOAuthAccountMessage(fullName, email, organization, providerFields[0], providerFields[1]); + String providerName = ""; + String providerUid = ""; + if(providerFields.length == 2) + { + providerName = providerFields[0]; + providerUid = providerFields[1]; + } + sendNewOAuthAccountMessage(fullName, localUid, email, organization, providerName, providerUid); } } - public void sendNewOAuthAccountMessage(String fullName, String email, String organization, String providerName, - String providerUid) { + public void sendNewOAuthAccountMessage(String fullName, String localUid, String email, String organization, + String providerName, String providerUid) { JSONObject jsonObj = new JSONObject(); jsonObj.put("uid", UUID.randomUUID()); jsonObj.put("subject", OAUTH2_ACCOUNT_CREATION); - jsonObj.put("username", fullName); + jsonObj.put("fullName", fullName); + jsonObj.put("localUid", localUid); jsonObj.put("email", email); jsonObj.put("organization", organization); jsonObj.put("providerName", providerName);