1 | <?php declare(strict_types = 1); |
||
19 | final class JwtToPsrMapper implements JwtToPsrMapperInterface |
||
20 | { |
||
21 | /** @var Signer */ |
||
22 | private $signer; |
||
23 | |||
24 | /** @var string */ |
||
25 | private $signatureKey; |
||
26 | |||
27 | /** @var string */ |
||
28 | private $verificationKey; |
||
29 | |||
30 | /** @var int */ |
||
31 | private $expirationTime; |
||
32 | |||
33 | /** @var int */ |
||
34 | private $refreshTime; |
||
35 | |||
36 | /** @var Parser */ |
||
37 | private $tokenParser; |
||
38 | |||
39 | /** @var SetCookie */ |
||
40 | private $defaultCookie; |
||
41 | |||
42 | 9 | public function __construct( |
|
60 | |||
61 | 1 | public static function fromAsymmetricKeyDefaults( |
|
79 | |||
80 | /** @return ?Token */ |
||
1 ignored issue
–
show
|
|||
81 | 4 | public function parseToken(ServerRequestInterface $request) |
|
82 | { |
||
83 | 4 | $cookies = $request->getCookieParams(); |
|
84 | 4 | $cookieName = $this->defaultCookie->getName(); |
|
85 | |||
86 | 4 | if (!isset($cookies[$cookieName])) { |
|
87 | 1 | return null; |
|
88 | } |
||
89 | |||
90 | try { |
||
91 | 3 | $token = $this->tokenParser->parse($cookies[$cookieName]); |
|
92 | 1 | } catch (\InvalidArgumentException $invalidToken) { |
|
93 | 1 | return null; |
|
94 | } |
||
95 | |||
96 | 2 | if (!$token->validate(new ValidationData())) { |
|
97 | 1 | return null; |
|
98 | } |
||
99 | |||
100 | 1 | return $token; |
|
101 | } |
||
102 | |||
103 | public function appendToken( |
||
121 | |||
122 | private function getExpirationCookie() : SetCookie |
||
130 | |||
131 | private function shouldTokenBeRefreshed(Token $token = null) : bool |
||
143 | |||
144 | private function getTokenCookie(SessionInterface $session) : SetCookie |
||
159 | |||
160 | 4 | public function extractSessionContainer(Token $token = null) : SessionInterface |
|
175 | } |
||
176 |
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.