This repository has been archived on 2025-01-19. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
drupalcampbristol/vendor/behat/mink-browserkit-driver/tests/web-fixtures/basic_auth.php

15 lines
517 B
PHP

<?php
$SERVER = $app['request']->server->all();
$username = isset($SERVER['PHP_AUTH_USER']) ? $SERVER['PHP_AUTH_USER'] : false;
$password = isset($SERVER['PHP_AUTH_PW']) ? $SERVER['PHP_AUTH_PW'] : false;
if ($username == 'mink-user' && $password == 'mink-password') {
echo 'is authenticated';
} else {
$resp = new \Symfony\Component\HttpFoundation\Response();
$resp->setStatusCode(401);
$resp->headers->set('WWW-Authenticate', 'Basic realm="Mink Testing Area"');
echo 'is not authenticated';
}