示例#1
0
文件: Jws.php 项目: emarref/jwt
 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);
 }
示例#2
0
 /**
  * @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));
 }