| 1 | <?php |
||
| 9 | class ServerRequestCookieProvider implements ServerRequestProviderInterface |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var array |
||
| 13 | */ |
||
| 14 | public const DEFAULT_OPTIONS = [ |
||
| 15 | 'cookieName' => 'jwt_token' |
||
| 16 | ]; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @var ServerRequestInterface |
||
| 20 | */ |
||
| 21 | private $request; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @var bool |
||
| 25 | */ |
||
| 26 | private $loaded = false; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @var string|null |
||
| 30 | */ |
||
| 31 | private $tokenString; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @var string |
||
| 35 | */ |
||
| 36 | private $cookieName; |
||
| 37 | |||
| 38 | /** |
||
| 39 | * HttpAuthenticationBearer constructor. |
||
| 40 | * |
||
| 41 | * @throws \InvalidArgumentException |
||
| 42 | * |
||
| 43 | * @param ServerRequestInterface $request |
||
| 44 | * @param string[] $options see self::DEFAULT_OPTIONS |
||
| 45 | */ |
||
| 46 | 10 | public function __construct(ServerRequestInterface $request, array $options = []) |
|
| 54 | |||
| 55 | /** |
||
| 56 | * @return bool |
||
| 57 | */ |
||
| 58 | 2 | public function hasToken(): bool |
|
| 66 | |||
| 67 | /** |
||
| 68 | * Return token string. |
||
| 69 | * |
||
| 70 | * |
||
| 71 | * @return string|null |
||
| 72 | */ |
||
| 73 | 7 | public function getPlainToken(): ?string |
|
| 81 | |||
| 82 | 8 | protected function loadTokenFromCookie(): void |
|
| 88 | } |
||
| 89 |