Skip to content

Commit

Permalink
MOSIP-29454
Browse files Browse the repository at this point in the history
  • Loading branch information
Sohandey committed Sep 14, 2023
1 parent 0577474 commit 201c750
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1,367 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3163,19 +3163,21 @@ public String inputJsonKeyWordHandeler(String jsonString, String testCaseName) {
if (jsonString.contains("$UINCODEVERIFIERPOS1$")) {
jsonString = replaceKeywordWithValue(jsonString, "$UINCODEVERIFIERPOS1$", UIN_CODE_VERIFIER_POS_1);
}

if (jsonString.contains("$CODECHALLENGE$")) {
jsonString = replaceKeywordWithValue(jsonString, "$CODECHALLENGE$", properties.getProperty("codeChallenge"));
jsonString = replaceKeywordWithValue(jsonString, "$CODECHALLENGE$",
properties.getProperty("codeChallenge"));
}

if (jsonString.contains("$CODEVERIFIER$")) {
jsonString = replaceKeywordWithValue(jsonString, "$CODEVERIFIER$", properties.getProperty("codeVerifier"));
}

if (jsonString.contains("$VCICONTEXTURL$")) {
jsonString = replaceKeywordWithValue(jsonString, "$VCICONTEXTURL$", properties.getProperty("vciContextURL"));
jsonString = replaceKeywordWithValue(jsonString, "$VCICONTEXTURL$",
properties.getProperty("vciContextURL"));
}

if (jsonString.contains("$PROOFJWT$")) {

String oidcJWKKeyString = getJWKKey(oidcJWK1);
Expand Down Expand Up @@ -4018,11 +4020,21 @@ public static String modifySchemaGenerateHbs(boolean regenerateHbs) {
JSONObject objIDJson = objIDJson4.getJSONObject(GlobalConstants.IDENTITY);
JSONObject objIDJson2 = objIDJson.getJSONObject(GlobalConstants.PROPERTIES);
JSONArray objIDJson1 = objIDJson.getJSONArray(GlobalConstants.REQUIRED);
String phone = getValueFromAuthActuator("json-property", "phone_number");
String result = phone.replaceAll("\\[\"|\"\\]", "");

if (!isElementPresent(objIDJson1, result)) {
objIDJson1.put(result);
}

System.out.println("result is:" + result);
String email = getValueFromAuthActuator("json-property", "emailId");
String emailResult = email.replaceAll("\\[\"|\"\\]", "");
if (!isElementPresent(objIDJson1, emailResult)) {
objIDJson1.put(emailResult);
}


// if (!isTargetEnvLTS()) {
objIDJson1.put(getValueFromAuthActuator("json-property", "phone_number"));
objIDJson1.put(getValueFromAuthActuator("json-property", "emailId"));
// }
fileWriter1 = new FileWriter(GlobalConstants.ADDIDENTITY_HBS);
fileWriter1.write("{\n");
fileWriter1.write(" \"id\": \"{{id}}\",\n");
Expand Down Expand Up @@ -4088,12 +4100,12 @@ public static String modifySchemaGenerateHbs(boolean regenerateHbs) {
+ "\t\t\"type\": \"DOC001\",\n" + "\t\t\"value\": \"fileReferenceID\"\n" + "\t },\n");
}

else if (objIDJson3.equals(getValueFromAuthActuator("json-property", "phone_number"))) {
else if (objIDJson3.equals(result)) {
fileWriter2
.write("\t \"" + objIDJson3 + "\":" + " " + "\"" + "{{" + objIDJson3 + "}}\"" + ",\n");
}

else if (objIDJson3.equals(getValueFromAuthActuator("json-property", "emailId"))) {
else if (objIDJson3.equals(emailResult)) {
fileWriter2
.write("\t \"" + objIDJson3 + "\":" + " " + "\"" + "{{" + objIDJson3 + "}}\"" + ",\n");
}
Expand Down Expand Up @@ -5316,5 +5328,15 @@ public static String inputTitleHandler(String jsonString) {

return jsonString;
}

public static boolean isElementPresent(JSONArray inputArray, String element) {
for (int i = 0; i < inputArray.length(); i++) {
String tempString = inputArray.getString(i);
if (tempString.equalsIgnoreCase(element)) {
return true;
}
}
return false;
}

}
Loading

0 comments on commit 201c750

Please sign in to comment.