You are here

protected function UsersJwtRequestTest::createRequest in JSON Web Token Authentication (JWT) 8

Create a request with UsersJwt authorization header.

Parameters

string $header_name: Header name.

string $token: The JWT token string.

Return value

\Symfony\Component\HttpFoundation\Request The new request.

1 call to UsersJwtRequestTest::createRequest()
UsersJwtRequestTest::testAuth in modules/users_jwt/tests/src/Kernel/UsersJwtRequestTest.php
Verify the authentication for a user.

File

modules/users_jwt/tests/src/Kernel/UsersJwtRequestTest.php, line 140

Class

UsersJwtRequestTest
Tests JWT config schema.

Namespace

Drupal\Tests\users_jwt\Kernel

Code

protected function createRequest($header_name, $token) : Request {
  $request = Request::create('/');
  $request->headers
    ->set($header_name, 'UsersJwt ' . $token);
  return $request;
}