Commit 83e1359e authored by alexpott's avatar alexpott

Issue #2107483 by StephaneQ: Make basic_auth() module and http_basic() auth setting consistent.

parent 6a89adcf
......@@ -54,7 +54,7 @@ public function cleanup(Request $request);
* Handles an exception.
*
* In case exception has happened we allow authentication providers react.
* Used in \Drupal\Core\Authentication\Provider\HttpBasic to set up headers to
* Used in \Drupal\Core\Authentication\Provider\BasicAuth to set up headers to
* prompt login.
*
* @param \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event
......
services:
authentication.http_basic:
class: Drupal\basic_auth\Authentication\Provider\HttpBasic
authentication.basic_auth:
class: Drupal\basic_auth\Authentication\Provider\BasicAuth
arguments: ['@config.factory']
tags:
- { name: authentication_provider, priority: 100 }
......@@ -2,7 +2,7 @@
/**
* @file
* Contains \Drupal\basic_auth\Authentication\Provider\HttpBasic.
* Contains \Drupal\basic_auth\Authentication\Provider\BasicAuth.
*/
namespace Drupal\basic_auth\Authentication\Provider;
......@@ -19,7 +19,7 @@
/**
* HTTP Basic authentication provider.
*/
class HttpBasic implements AuthenticationProviderInterface {
class BasicAuth implements AuthenticationProviderInterface {
/**
* The config factory.
......
......@@ -2,19 +2,19 @@
/**
* @file
* Contains \Drupal\basic_auth\Tests\Authentication\HttpBasicTest.
* Contains \Drupal\basic_auth\Tests\Authentication\BasicAuthTest.
*/
namespace Drupal\basic_auth\Tests\Authentication;
use Drupal\Core\Authentication\Provider\HttpBasic;
use Drupal\Core\Authentication\Provider\BasicAuth;
use Drupal\simpletest\WebTestBase;
use Symfony\Component\HttpFoundation\Request;
/**
* Test for http basic authentication.
*/
class HttpBasicTest extends WebTestBase {
class BasicAuthTest extends WebTestBase {
/**
* Modules enabled for all tests.
......@@ -25,8 +25,8 @@ class HttpBasicTest extends WebTestBase {
public static function getInfo() {
return array(
'name' => 'HttpBasic authentication',
'description' => 'Tests for HttpBasic authentication provider.',
'name' => 'BasicAuth authentication',
'description' => 'Tests for BasicAuth authentication provider.',
'group' => 'Authentication',
);
}
......@@ -34,7 +34,7 @@ public static function getInfo() {
/**
* Test http basic authentication.
*/
public function testHttpBasic() {
public function testBasicAuth() {
$account = $this->drupalCreateUser();
$this->basicAuthGet('router_test/test11', $account->getUsername(), $account->pass_raw);
......@@ -48,7 +48,7 @@ public function testHttpBasic() {
$this->curlClose();
$this->drupalGet('router_test/test11');
$this->assertResponse('401', 'Not authenticated on the route that allows only http_basic. Prompt to authenticate received.');
$this->assertResponse('401', 'Not authenticated on the route that allows only basic_auth. Prompt to authenticate received.');
$this->drupalGet('admin');
$this->assertResponse('403', 'No authentication prompt for routes not explicitly defining authentication providers.');
......
......@@ -23,4 +23,4 @@ resources:
# entity:node:
# POST:
# supported_auth:
# - http_basic
# - basic_auth
......@@ -39,7 +39,7 @@ public function testRead() {
$entity_type = 'entity_test';
// Enable a test resource through GET method and basic HTTP authentication.
$this->enableService('entity:' . $entity_type, 'GET', NULL, array('http_basic'));
$this->enableService('entity:' . $entity_type, 'GET', NULL, array('basic_auth'));
// Create an entity programmatically.
$entity = $this->entityCreate($entity_type);
......
......@@ -66,7 +66,7 @@ router_test.10:
router_test.11:
path: '/router_test/test11'
options:
_auth: [ 'http_basic' ]
_auth: [ 'basic_auth' ]
requirements:
_user_is_logged_in: 'TRUE'
defaults:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment