Source:
<code>private void createNewUser() throws IOException { String trustStorePath = wso2isPath.resolve("repository").resolve("resources") .resolve("security").resolve("wso2carbon.jks").toString(); String trustStorePass = "wso2carbon"; System.setProperty("javax.net.ssl.trustStore", trustStorePath); System.setProperty("javax.net.ssl.trustStorePassword", trustStorePass); String encoding = new BASE64Encoder().encode("admin:admin".getBytes(UTF_8)); URL requestUrlPost = new URL("https://localhost:9443/wso2/scim/Users"); HttpURLConnection connectionPost = (HttpURLConnection) requestUrlPost.openConnection(); connectionPost.setDoOutput(true); connectionPost.setRequestMethod("POST"); connectionPost.setRequestProperty("Authorization", "Basic " + encoding); <START> byte[] out = ("{\"schemas\":[],\"name\":{\"familyName\":\"family\",\"givenName\":\"Peter\"}," <END> + "\"userName\":\"peter\",\"password\":\"peter123\"," + "\"emails\":[{\"primary\":true,\"value\":\"wso2_home.com\",\"type\":\"home\"}," + "{\"value\":\"wso2_work.com\",\"type\":\"work\"}]}") .getBytes(UTF_8); int length = out.length; connectionPost.setFixedLengthStreamingMode(length); connectionPost.setRequestProperty("Content-Type", "application/json; charset=UTF-8"); connectionPost.setRequestProperty("Accept", "application/json; charset=UTF-8"); try (OutputStream os = connectionPost.getOutputStream()) { os.write(out); } int responseCodePost = connectionPost.getResponseCode(); if (responseCodePost == 201) { try (BufferedReader br = new BufferedReader( new InputStreamReader((connectionPost.getInputStream()), UTF_8))) { StringBuilder sb = new StringBuilder(); String output; while ((output = br.readLine()) != null) { sb.append(output); } if (!sb.toString().contains("created")) { throw new IOException("Error occured while creating a user in WSO2 Identity Server."); } } } else if (responseCodePost != 409) { throw new IOException("Error occured while creating a user in WSO2 Identity Server."); } }</code><technical_language>username password constants</technical_language>

Target:
private void createNewUser() throws IOException { String trustStorePath = wso2isPath.resolve("repository").resolve("resources") .resolve("security").resolve("wso2carbon.jks").toString(); String trustStorePass = "wso2carbon"; System.setProperty("javax.net.ssl.trustStore", trustStorePath); System.setProperty("javax.net.ssl.trustStorePassword", trustStorePass); String encoding = new BASE64Encoder().encode("admin:admin".getBytes(UTF_8)); URL requestUrlPost = new URL(WSO2_IS_URL + "/wso2/scim/Users"); HttpURLConnection connectionPost = (HttpURLConnection) requestUrlPost.openConnection(); connectionPost.setDoOutput(true); connectionPost.setRequestMethod("POST"); connectionPost.setRequestProperty("Authorization", "Basic " + encoding); byte[] out = ("{\"schemas\":[],\"name\":{\"familyName\":\"family\",\"givenName\":\"" + USERNAME + "\"}," + "\"userName\":\"" + USERNAME + "\",\"password\":\"" + PASSWORD + "\"," + "\"emails\":[{\"primary\":true,\"value\":\"wso2_home.com\",\"type\":\"home\"}," + "{\"value\":\"wso2_work.com\",\"type\":\"work\"}]}") .getBytes(UTF_8); int length = out.length; connectionPost.setFixedLengthStreamingMode(length); connectionPost.setRequestProperty("Content-Type", "application/json; charset=UTF-8"); connectionPost.setRequestProperty("Accept", "application/json; charset=UTF-8"); try (OutputStream os = connectionPost.getOutputStream()) { os.write(out); } int responseCodePost = connectionPost.getResponseCode(); if (responseCodePost == 201) { try (BufferedReader br = new BufferedReader( new InputStreamReader((connectionPost.getInputStream()), UTF_8))) { StringBuilder sb = new StringBuilder(); String output; while ((output = br.readLine()) != null) { sb.append(output); } if (!sb.toString().contains("created")) { throw new IOException("Error occured while creating a user in WSO2 Identity Server."); } } } else if (responseCodePost != 409) { throw new IOException("Error occured while creating a user in WSO2 Identity Server."); } }