public function SecuresiteManager::_securesite_digest_validate in Secure Site 8
Get the result of digest validation.
Parameters
$status: Will be set to the return status of the validation script
$edit: An array of parameters to pass to the validation script
Return value
An HTTP header string.
3 calls to SecuresiteManager::_securesite_digest_validate()
- SecuresiteManager::denied in src/
SecuresiteManager.php - Deny access to users who are not authorized to access secured pages.
- SecuresiteManager::digestAuth in src/
SecuresiteManager.php - Perform digest authentication.
- SecuresiteManager::showDialog in src/
SecuresiteManager.php
File
- src/
SecuresiteManager.php, line 331 - Contains \Drupal\securesite\SecuresiteManager.
Class
Namespace
Drupal\securesiteCode
public function _securesite_digest_validate(&$status, $edit = array()) {
static $header;
$edit['site_path'] = DrupalKernel::findSitePath(\Drupal::request());
if (!empty($edit)) {
$args = array();
foreach ($edit as $key => $value) {
$args[] = "{$key}=" . escapeshellarg($value);
}
$script = \Drupal::config('securesite.settings')
->get('securesite_digest_script');
$response = exec($script . ' ' . implode(' ', $args), $output, $status);
// drupal_set_header() is now drupal_add_http_header() and requires headers passed as name, value in an array.
// The script returns a string, so we shall break it up as best we can. The existing code doesn't seem
// to worry about correct data to append to 'WWW-Authenticate: ' etc so I won't add any for the D7 conversion.
/* $response_explode = explode('=', $response);
$name = array_shift($response_explode);
$value = implode('=', $response_explode);*/
if (isset($edit['data']) && empty($status)) {
$header = array(
'name' => "Authentication-Info",
'value' => $response,
);
}
else {
$header = array(
'name' => "WWW-Authenticate",
'value' => 'Digest ' . $response,
);
}
}
return $header;
}