diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/UserManagementServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/UserManagementServiceImpl.java index 329c5599032..8bcb3d934b9 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/UserManagementServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/UserManagementServiceImpl.java @@ -143,7 +143,13 @@ public class UserManagementServiceImpl implements UserManagementService { "was refused.").build()).build(); } - String initialUserPassword = this.generateInitialUserPassword(); + String initialUserPassword; + if (userInfo.getPassword() != null) { + initialUserPassword = userInfo.getPassword(); + } else { + initialUserPassword = this.generateInitialUserPassword(); + } + Map defaultUserClaims = this.buildDefaultUserClaims(userInfo.getFirstname(), userInfo.getLastname(), userInfo.getEmailAddress());