/** * @param string $jsonWebToken * * @return JWT $this */ public function load($jsonWebToken) { $this->jsonWebToken = $jsonWebToken; $jwtSegment = explode('.', $this->jsonWebToken); if (count($jwtSegment) != 3) { $this->payloadData = array(); $this->tokenValidated = false; return $this; } $createdSignature = $this->secureHash($jwtSegment[0] . '.' . $jwtSegment[1]); $providedSignature = $this->encoder->decode($jwtSegment[2]); if ($this->verifyHash($createdSignature, $providedSignature)) { $this->payloadData = $this->encoder->decodeData($jwtSegment[1]); $this->tokenValidated = true; } else { $this->payloadData = array(); $this->tokenValidated = false; } return $this; }