From 235eef416587ffd9d89101c62670525fdc8c4812 Mon Sep 17 00:00:00 2001 From: Neha Farheen Date: Tue, 22 Aug 2023 13:58:26 +0530 Subject: [PATCH 1/3] Added the flag condition to check env --- .../service/validator/AuthRequestValidator.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/validator/AuthRequestValidator.java b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/validator/AuthRequestValidator.java index e3e801d7b4a..59e5dd24771 100644 --- a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/validator/AuthRequestValidator.java +++ b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/validator/AuthRequestValidator.java @@ -17,6 +17,7 @@ import javax.annotation.PostConstruct; +import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Primary; import org.springframework.stereotype.Component; import org.springframework.validation.Errors; @@ -76,6 +77,9 @@ public class AuthRequestValidator extends BaseAuthRequestValidator { */ private List allowedDomainUris; + @Value("${mosip.ida.validate-allowed-env-enabled:true}") + private boolean isallowedEnabled; + @PostConstruct public void initialize() { allowedEnvironments = Arrays.stream(EnvUtil.getAllowedEnv().split((","))) @@ -645,9 +649,12 @@ private Date biometricTimestampParser(String timestamp) throws ParseException { * @return */ private boolean isValuesContainsIgnoreCase(List values, String value) { - if (value != null) { - return values.stream().anyMatch(value::equalsIgnoreCase); + if (isallowedEnabled) { + if (value != null) { + return values.stream().anyMatch(value::equalsIgnoreCase); + } + return false; } - return false; + return true; } } \ No newline at end of file From f1c6b2563fdd2a6f8eb026a2b7e7516da4807642 Mon Sep 17 00:00:00 2001 From: Neha Farheen Date: Tue, 22 Aug 2023 16:05:17 +0530 Subject: [PATCH 2/3] Added the flag condition to check env --- .../common/service/validator/AuthRequestValidator.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/validator/AuthRequestValidator.java b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/validator/AuthRequestValidator.java index 59e5dd24771..468766e671f 100644 --- a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/validator/AuthRequestValidator.java +++ b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/validator/AuthRequestValidator.java @@ -78,7 +78,7 @@ public class AuthRequestValidator extends BaseAuthRequestValidator { private List allowedDomainUris; @Value("${mosip.ida.validate-allowed-env-enabled:true}") - private boolean isallowedEnabled; + private boolean isAllowedEnvValidationEnabled; @PostConstruct public void initialize() { @@ -649,7 +649,7 @@ private Date biometricTimestampParser(String timestamp) throws ParseException { * @return */ private boolean isValuesContainsIgnoreCase(List values, String value) { - if (isallowedEnabled) { + if (isAllowedEnvValidationEnabled) { if (value != null) { return values.stream().anyMatch(value::equalsIgnoreCase); } From e4f098b6f338d0a68ff8a84a50714cb69bce9c07 Mon Sep 17 00:00:00 2001 From: Neha Farheen Date: Fri, 1 Sep 2023 18:48:37 +0530 Subject: [PATCH 3/3] Reverse the condition of flag --- .../common/service/validator/AuthRequestValidator.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/validator/AuthRequestValidator.java b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/validator/AuthRequestValidator.java index 468766e671f..769561313d4 100644 --- a/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/validator/AuthRequestValidator.java +++ b/authentication/authentication-common/src/main/java/io/mosip/authentication/common/service/validator/AuthRequestValidator.java @@ -77,8 +77,8 @@ public class AuthRequestValidator extends BaseAuthRequestValidator { */ private List allowedDomainUris; - @Value("${mosip.ida.validate-allowed-env-enabled:true}") - private boolean isAllowedEnvValidationEnabled; + @Value("${mosip.ida.validate-env-disabled:false}") + private boolean isEnvValidationDisabled; @PostConstruct public void initialize() { @@ -649,7 +649,7 @@ private Date biometricTimestampParser(String timestamp) throws ParseException { * @return */ private boolean isValuesContainsIgnoreCase(List values, String value) { - if (isAllowedEnvValidationEnabled) { + if (!isEnvValidationDisabled) { if (value != null) { return values.stream().anyMatch(value::equalsIgnoreCase); }