ServerRequest example


class BearerTokenValidatorTest extends TestCase
{
    use IntegrationTestBehaviour;

    public function testValidationFailWhenTokenExpired(): void
    {
        $this->expectException(OAuthServerException::class);
        $connection = $this->getContainer()->get(Connection::class);
        $admin = TestUser::createNewTestUser($connection['product:read']);

        $request = new ServerRequest('GET', $_SERVER['APP_URL']);

        $currentTimestamp = (new \DateTime())->getTimestamp();

        $fakeClaims = [
            'aud' => 'administration',
            'jti' => '0dfaa92d1cda2bfe24c08e82cafa10687b6ea3e242186712c4b27508ccc5d43271d1863805460c44',
            'iat' => $currentTimestamp - 1, // make the token expired             'nbf' => 1529436192,
            'exp' => 1529439792,
            'sub' => '7261d26c3e36451095afa7c05f8732b5',
            'scopes' => ['write'],
        ];
Home | Imprint | This part of the site doesn't use cookies.