public function SecuresiteManager::denied in Secure Site 8
Deny access to users who are not authorized to access secured pages.
2 calls to SecuresiteManager::denied()
File
- src/
SecuresiteManager.php, line 437 - Contains \Drupal\securesite\SecuresiteManager.
Class
Namespace
Drupal\securesiteCode
public function denied($message) {
$request = $this->request;
if (empty($_SESSION['securesite_denied'])) {
// Unset messages from previous log-in attempts.
if (isset($_SESSION['messages'])) {
unset($_SESSION['messages']);
}
// Set a session variable so that the log-in dialog will be displayed when the page is reloaded.
$_SESSION['securesite_denied'] = TRUE;
$types = \Drupal::config('securesite.settings')
->get('securesite_type');
if (array_pop($types) != SECURESITE_FORM) {
$this->request->securesiteHeaders += array(
'Status' => '403',
);
}
else {
drupal_set_message(Xss::Filter($message), 'error');
// Theme and display output
$content = $this
->dialogPage();
print _theme('securesite_page', array(
'content' => $content,
));
// Exit
exit;
}
}
else {
unset($_SESSION['securesite_denied']);
// Safari will attempt to use old credentials before requesting new credentials
// from the user. Logging out requires that the WWW-Authenticate header be sent
// twice.
$user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? drupal_strtolower($_SERVER['HTTP_USER_AGENT']) : '';
if ($user_agent != str_replace('safari', '', $user_agent)) {
$_SESSION['securesite_repeat'] = TRUE;
}
$types = \Drupal::config('securesite.settings')
->get('securesite_type');
//todo fix next few lines
if (in_array(SECURESITE_DIGEST, $types)) {
// Reset the digest header.
$realm = \Drupal::config('securesite.settings')
->get('securesite_realm');
$this
->_securesite_digest_validate($status, array(
'realm' => $realm,
'fakerealm' => $this
->getFakeRealm(),
));
}
if ($this
->getType() == SECURESITE_FORM) {
drupal_set_message(Xss::Filter($message), 'error');
// Theme and display output
$content = $this
->dialogPage();
print _theme('securesite_page', array(
'content' => $content,
));
// Exit
exit;
}
else {
$this
->showDialog($this
->getType());
}
}
}