Skip to content

Commit 53faa13

Browse files
committed
adding Request MLE Validation for JWT
1 parent 48ff043 commit 53faa13

2 files changed

Lines changed: 16 additions & 16 deletions

File tree

lib/Authentication/Core/MerchantConfiguration.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1413,22 +1413,22 @@ public function validateMerchantData()
14131413
}
14141414

14151415
private function validateMLEConfiguration(){
1416-
// $mleConfigured = $this->enableRequestMLEForOptionalApisGlobally;
1417-
// if ($this->mapToControlMLEonAPI !== null && !empty($this->mapToControlMLEonAPI)) {
1418-
// foreach ($this->mapToControlMLEonAPI as $value) {
1419-
// if ($value) {
1420-
// $mleConfigured = true;
1421-
// break;
1422-
// }
1423-
// }
1424-
// }
1416+
$requestMleConfigured = $this->enableRequestMLEForOptionalApisGlobally;
1417+
if ($this->mapToControlMLEonAPI !== null && !empty($this->mapToControlMLEonAPI)) {
1418+
foreach ($this->mapToControlMLEonAPI as $value) {
1419+
if ($value) {
1420+
$requestMleConfigured = true;
1421+
break;
1422+
}
1423+
}
1424+
}
14251425
// if MLE=true then check for auth Type
1426-
// if ($mleConfigured && strcasecmp($this->authenticationType, GlobalParameter::JWT) !== 0) {
1427-
// $error_message = GlobalParameter::MLE_AUTH_ERROR;
1428-
// $exception = new AuthException($error_message, 0);
1429-
// self::$logger->error($error_message);
1430-
// throw $exception;
1431-
// }
1426+
if ($requestMleConfigured && strcasecmp($this->authenticationType, GlobalParameter::JWT) !== 0) {
1427+
$error_message = GlobalParameter::REQUEST_MLE_AUTH_ERROR;
1428+
$exception = new AuthException($error_message, 0);
1429+
self::$logger->error($error_message);
1430+
throw $exception;
1431+
}
14321432

14331433
if (isset($this->mleForRequestPublicCertPath)) {
14341434
$certPath = $this->mleForRequestPublicCertPath;

lib/Authentication/Util/GlobalParameter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class GlobalParameter
107107
const KEYFILEFIELDDIR = "keysDirectory ";
108108
const DEFAULT_MLE_ALIAS_FOR_CERT = "CyberSource_SJC_US";
109109
const CERTIFICATE_EXPIRY_DATE_WARNING_DAYS = 90;
110-
const MLE_AUTH_ERROR = "MLE is only supported in JWT auth type";
110+
const REQUEST_MLE_AUTH_ERROR = "Request MLE is only supported in JWT auth type";
111111
const EMPTY_PRIVATE_OR_PUBLIC_KEY_ERROR = "Private key or public key is empty";
112112
}
113113
?>

0 commit comments

Comments
 (0)