/** * @param $request * @return array * @throws \Exception */ public function read($request) { $token = $this->getAuthorizationHeader($request); $this->jws = $this->jws->callLoad($token); $algo = $this->algoFactory->make(); if (!$this->jws->verify($algo->getKeyForVerifying(), $this->algoritihim)) { throw new \Exception('JWT algoritihim used for signing does not match algoritihim used for verifying'); } if ($this->jws->isExpired($algo->getKeyForVerifying(), $this->algoritihim)) { throw new \Exception('JWT has expired'); } return $this->jws->getPayload(); }