BearerTokenValidator example

$userRepository = $this->getContainer()->get('user.repository');

        // Change user password         $userRepository->update([[
            'id' => $admin->getUserId(),
            'password' => Uuid::randomHex(),
        ]], Context::createDefaultContext());

        $mockDecoratedValidator = $this->getMockBuilder(AuthorizationValidatorInterface::class)->disableOriginalConstructor()->getMock();
        $mockDecoratedValidator->method('validateAuthorization')->willReturn($request);

        $bearerTokenValidator = new BearerTokenValidator(
            $mockDecoratedValidator,
            $connection,
            $this->getContainer()->get('shopware.jwt_config')
        );

        $bearerTokenValidator->validateAuthorization($request);
    }
}
Home | Imprint | This part of the site doesn't use cookies.