/** * Parses the claim set from a string * * @param string $data * * @return array */ protected function parseClaims($data) { $claims = (array) $this->deserializer->fromJSON($this->deserializer->fromBase64URL($data)); foreach ($claims as $name => &$value) { $value = $this->claimFactory->create($name, $value); } return $claims; }
/** * {@inheritdoc} */ public function decode($token) { $parser = new Parser(); $token = $parser->parse($token); try { if (true === $token->verify(new Sha512(), $this->secret)) { $serializer = new Serializer(); $deserializer = new Deserializer(); $claims = $token->getClaims(); return (array) $deserializer->fromJSON($serializer->toJSON($claims)); } else { return false; } } catch (\BadMethodCallException $e) { return false; } }