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

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