vendor/lexik/jwt-authentication-bundle/Response/JWTAuthenticationSuccessResponse.php line 13

Open in your IDE?
  1. <?php
  2. namespace Lexik\Bundle\JWTAuthenticationBundle\Response;
  3. use Symfony\Component\HttpFoundation\Cookie;
  4. use Symfony\Component\HttpFoundation\JsonResponse;
  5. /**
  6.  * Response sent on successful JWT authentication.
  7.  *
  8.  * @author Robin Chalas <robin.chalas@gmail.com>
  9.  */
  10. final class JWTAuthenticationSuccessResponse extends JsonResponse
  11. {
  12.     /**
  13.      * @param string $token Json Web Token
  14.      * @param array  $data  Extra data passed to the response
  15.      */
  16.     public function __construct($token, array $data = [], array $jwtCookies = [])
  17.     {
  18.         if (!$jwtCookies) {
  19.             parent::__construct(['token' => $token] + $data);
  20.             return;
  21.         }
  22.         parent::__construct($data);
  23.         foreach ($jwtCookies as $cookie) {
  24.             $this->headers->setCookie($cookie);
  25.         }
  26.     }
  27. }