From 3c23d1d81a7ad8782eb54e2e26364fc6bb0ba431 Mon Sep 17 00:00:00 2001 From: Myystigri Date: Thu, 27 Feb 2020 17:28:37 +0100 Subject: [PATCH] Update deprecated methods --- mercure.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mercure.rst b/mercure.rst index 6d954d5e881..1f4034daa5c 100644 --- a/mercure.rst +++ b/mercure.rst @@ -398,6 +398,7 @@ And here is the controller:: use Lcobucci\JWT\Builder; use Lcobucci\JWT\Signer\Hmac\Sha256; + use Lcobucci\JWT\Signer\Key; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -413,9 +414,8 @@ And here is the controller:: $username = $this->getUser()->getUsername(); // Retrieve the username of the current user $token = (new Builder()) // set other appropriate JWT claims, such as an expiration date - ->set('mercure', ['subscribe' => ["http://example.com/user/$username"]]) // could also include the security roles, or anything else - ->sign(new Sha256(), $this->getParameter('mercure_secret_key')) // don't forget to set this parameter! Test value: aVerySecretKey - ->getToken(); + ->withClaim('mercure', ['subscribe' => ["http://example.com/user/$username"]]) // could also include the security roles, or anything else + ->getToken(new Sha256(), new Key($this->getParameter('mercure_secret_key'))); // don't forget to set this parameter! Test value: aVerySecretKey $response = $this->json(['@id' => '/demo/books/1', 'availability' => 'https://schema.org/InStock']); $response->headers->set(