protected function JwtPathAuthTest::setUp in JSON Web Token Authentication (JWT) 8
Overrides BrowserTestBase::setUp
File
- tests/
src/ Functional/ JwtPathAuthTest.php, line 51
Class
- JwtPathAuthTest
- Tests path-based authentication.
Namespace
Drupal\Tests\jwt\FunctionalCode
protected function setUp() {
parent::setUp();
$this->adminUser = $this
->drupalCreateUser([
'administer jwt',
'access content',
]);
// Enable a REST resource for file entities to verify that that path-based
// auth can also be used to authenticate REST requests.
$params = [
'id' => 'entity.file',
'plugin_id' => 'entity:file',
'granularity' => 'resource',
'configuration' => [
'authentication' => [
'cookie',
'jwt_path_auth',
],
'methods' => [
'GET',
],
'formats' => [
'json',
],
],
];
$storage = $this->container
->get('entity_type.manager')
->getStorage('rest_resource_config');
$resource = $storage
->create($params);
$resource
->save();
$this->container
->get('router.builder')
->rebuild();
}