Skip to content

Commit

Permalink
DIS-269 Improve reliability of authenticating tokens for LiDA
Browse files Browse the repository at this point in the history
  • Loading branch information
mdnoble73 committed Jan 23, 2025
1 parent 9855657 commit 7e50c9b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
14 changes: 5 additions & 9 deletions code/web/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,25 +140,21 @@ protected function grantTokenAccess()
'key2' => base64_decode($_SERVER['PHP_AUTH_PW'])
)
);
$opts = array('http' =>
array(
'method' => 'POST',
'header' => 'Content-Type: application/x-www-form-urlencoded',
'content' => $postData
)
);
$context = stream_context_create($opts);
require_once ROOT_DIR . '/sys/SystemVariables.php';
$systemVariables = SystemVariables::getSystemVariables();
if ($systemVariables && !empty($systemVariables->greenhouseUrl)) {
if ($result = file_get_contents($systemVariables->greenhouseUrl . '/API/GreenhouseAPI?method=authenticateTokens', false, $context)) {
require_once ROOT_DIR . '/sys/CurlWrapper.php';
$curlWrapper = new CurlWrapper();
$result = $curlWrapper->curlPostPage($systemVariables->greenhouseUrl . '/API/GreenhouseAPI?method=authenticateTokens', $postData);
if (!empty($result)) {
$data = json_decode($result, true);
$isValid = $data['success'];

if($isValid) {
return true;
}
}

} else {
global $configArray;
if ($result = file_get_contents($configArray['Site']['url'] . '/API/GreenhouseAPI?method=authenticateTokens', false, $context)) {
Expand Down
1 change: 1 addition & 0 deletions code/web/release_notes/25.02.00.MD
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
- Streamline where Action.php is included. (DIS-247) (*MDN*)
- Allow Release Notes to be bookmarked. (DIS-255) (*MDN*)
- Correctly format the Date Scheduled and Date Run fields within the Scheduled Update Details popup. (*MDN*)
- Improve reliability of authenticating tokens for LiDA (DIS-269) (*MDN*)

//leo
### Indexing Updates
Expand Down
3 changes: 2 additions & 1 deletion code/web/services/API/GreenhouseAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function launch() {
'getNotificationAccessToken',
'updateAspenLiDABuild',
]) && !IPAddress::allowAPIAccessForClientIP()) {

$this->forbidAPIAccess();
}

Expand Down Expand Up @@ -81,7 +82,7 @@ public function authenticateTokens(): array {
}
}

if ($keychain['1'] && $keychain['2'] == true) {
if ($keychain['1'] === true && $keychain['2'] === true) {
return ['success' => true];
}
}
Expand Down

0 comments on commit 7e50c9b

Please sign in to comment.