function system_test_basic_auth_page in Drupal 7
1 string reference to 'system_test_basic_auth_page'
- system_test_menu in modules/
simpletest/ tests/ system_test.module - Implements hook_menu().
File
- modules/
simpletest/ tests/ system_test.module, line 151
Code
function system_test_basic_auth_page() {
// The Authorization HTTP header is forwarded via Drupal's .htaccess file even
// for PHP CGI SAPIs.
if (isset($_SERVER['HTTP_AUTHORIZATION'])) {
$authorization_header = $_SERVER['HTTP_AUTHORIZATION'];
}
elseif (isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION'])) {
$authorization_header = $_SERVER['REDIRECT_HTTP_AUTHORIZATION'];
}
// Resemble PHP_AUTH_USER and PHP_AUTH_PW for a Basic authentication from
// the HTTP_AUTHORIZATION header. See
// http://www.php.net/manual/features.http-auth.php
list($user, $pw) = explode(':', base64_decode(substr($authorization_header, 6)));
$output = t('Username is @username.', array(
'@username' => $user,
));
$output .= t('Password is @password.', array(
'@password' => $pw,
));
return $output;
}