Skip to content

Commit

Permalink
Merge pull request mosip#1176 from nandhu-kumar/develop
Browse files Browse the repository at this point in the history
MOSIP-29993
  • Loading branch information
lsivanand authored Nov 2, 2023
2 parents 31de073 + bc23952 commit bd165ca
Showing 1 changed file with 38 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ public static BioDataUtility getBioDataUtil() {
/** The Constant SIGN_ALGO. */
private static final String SIGN_ALGO = "RS256";
public static final int OTP_CHECK_INTERVAL = 10000;

private static final Map<String, String> actuatorValueCache = new HashMap<>();

protected static boolean triggerESignetKeyGen1 = true;

Expand Down Expand Up @@ -5270,7 +5272,11 @@ public static int getOtpExpTimeFromActuator() {

public static String getValueFromActuator(String section, String key) {
String url = ApplnURI + propsKernel.getProperty("actuatorEndpoint");
String value = null;
String actuatorCacheKey = url + section + key;
String value = actuatorValueCache.get(actuatorCacheKey);
if (value != null && !value.isEmpty())
return value;

try {
if (residentActuatorResponseArray == null) {
Response response = null;
Expand All @@ -5290,6 +5296,7 @@ public static String getValueFromActuator(String section, String key) {
break;
}
}
actuatorValueCache.put(actuatorCacheKey, value);

return value;
} catch (Exception e) {
Expand All @@ -5302,8 +5309,12 @@ public static String getValueFromActuator(String section, String key) {
public static JSONArray esignetActuatorResponseArray = null;

public static String getValueFromEsignetActuator(String section, String key) {
String value = null;
String url = ConfigManager.getEsignetBaseUrl() + propsKernel.getProperty("actuatorEsignetEndpoint");
String actuatorCacheKey = url + section + key;
String value = actuatorValueCache.get(actuatorCacheKey);
if (value != null && !value.isEmpty())
return value;

try {
if (esignetActuatorResponseArray == null) {
Response response = null;
Expand All @@ -5323,7 +5334,8 @@ public static String getValueFromEsignetActuator(String section, String key) {
break;
}
}

actuatorValueCache.put(actuatorCacheKey, value);

return value;
} catch (Exception e) {
logger.error(GlobalConstants.EXCEPTION_STRING_2 + e);
Expand All @@ -5336,7 +5348,10 @@ public static String getValueFromEsignetActuator(String section, String key) {

public static String getValueFromAuthActuator(String section, String key) {
String url = ApplnURI + propsKernel.getProperty("actuatorIDAEndpoint");
String value = null;
String actuatorCacheKey = url + section + key;
String value = actuatorValueCache.get(actuatorCacheKey);
if (value != null && !value.isEmpty())
return value;
try {
if (authActuatorResponseArray == null) {
Response response = null;
Expand All @@ -5357,6 +5372,7 @@ public static String getValueFromAuthActuator(String section, String key) {
break;
}
}
actuatorValueCache.put(actuatorCacheKey, value);

return value;
} catch (Exception e) {
Expand All @@ -5371,7 +5387,14 @@ public static String getValueFromAuthActuator(String section, String key) {
public static String getValueFromConfigActuator() {

String url = ApplnURI + propsKernel.getProperty("actuatorEndpoint");
String claims = null;

String actuatorCacheKey = url + "mosip.iam.module.login_flow.claims";

String claims = actuatorValueCache.get(actuatorCacheKey);

if (claims != null && !claims.isEmpty())
return claims;

try {
if (configActuatorResponseArray == null) {
Response response = null;
Expand All @@ -5394,6 +5417,8 @@ public static String getValueFromConfigActuator() {
}
}

actuatorValueCache.put(actuatorCacheKey, claims);

return claims;
} catch (Exception e) {
logger.error(GlobalConstants.EXCEPTION_STRING_2 + e);
Expand All @@ -5406,7 +5431,12 @@ public static String getValueFromConfigActuator() {

public static String getRegprocWaitFromActuator() {
String url = ApplnURI + propsKernel.getProperty("actuatorRegprocEndpoint");
String waitInterval = null;

String actuatorCacheKey = url + "registration.processor.reprocess.minutes";
String waitInterval = actuatorValueCache.get(actuatorCacheKey);
if (waitInterval != null && !waitInterval.isEmpty())
return waitInterval;

try {
if (regProcActuatorResponseArray == null) {
Response response = null;
Expand All @@ -5427,6 +5457,8 @@ public static String getRegprocWaitFromActuator() {
break;
}
}

actuatorValueCache.put(actuatorCacheKey, waitInterval);

return waitInterval;
} catch (Exception e) {
Expand Down

0 comments on commit bd165ca

Please sign in to comment.