public function getUnsignedValue(Token $token) { $jsonHeader = $token->getHeader()->getParameters()->jsonSerialize(); $encodedHeader = $this->encoder->encode($jsonHeader); $jsonPayload = $token->getPayload()->getClaims()->jsonSerialize(); $encodedPayload = $this->encoder->encode($jsonPayload); return sprintf('%s.%s', $encodedHeader, $encodedPayload); }
/** * @param Token $token * @return string */ public function serialize(Token $token) { $serializedHeader = $token->getHeader()->getParameters()->jsonSerialize(); $serializedPayload = $token->getPayload()->getClaims()->jsonSerialize(); $signature = $token->getSignature(); return sprintf('%s.%s.%s', $this->encoding->encode($serializedHeader), $this->encoding->encode($serializedPayload), $this->encoding->encode($signature)); }