Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -76,6 +77,9 @@ public class AuthRequestValidator extends BaseAuthRequestValidator {
*/
private List<String> allowedDomainUris;

@Value("${mosip.ida.validate-allowed-env-enabled:true}")
private boolean isAllowedEnvValidationEnabled;

@PostConstruct
public void initialize() {
allowedEnvironments = Arrays.stream(EnvUtil.getAllowedEnv().split((",")))
Expand Down Expand Up @@ -475,6 +479,7 @@ private void validateEnv(AuthRequestDTO authRequestDto, Errors errors) {
}

// request env is not null and not matching with configurations

if (authRequestDto.getEnv() != null
&& !isValuesContainsIgnoreCase(allowedEnvironments, authRequestDto.getEnv())) {
mosipLogger.error(IdAuthCommonConstants.SESSION_ID, this.getClass().getSimpleName(),
Expand Down Expand Up @@ -645,9 +650,12 @@ private Date biometricTimestampParser(String timestamp) throws ParseException {
* @return
*/
private boolean isValuesContainsIgnoreCase(List<String> values, String value) {
if (value != null) {
return values.stream().anyMatch(value::equalsIgnoreCase);
if (isAllowedEnvValidationEnabled) {
if (value != null) {
return values.stream().anyMatch(value::equalsIgnoreCase);
}
return false;
}
return false;
return true;
}
}