예제 #1
0
 /**
  * Configures a claim item
  *
  * @param string $name
  * @param mixed $value
  *
  * @return Builder
  *
  * @throws BadMethodCallException When data has been already signed
  */
 public function set($name, $value)
 {
     if ($this->signature) {
         throw new BadMethodCallException('You must unsign before make changes');
     }
     $this->claims[(string) $name] = $this->claimFactory->create($name, $value);
     return $this;
 }
예제 #2
0
 /**
  * Parses the claim set from a string
  *
  * @param string $data
  *
  * @return array
  */
 protected function parseClaims($data)
 {
     $claims = (array) $this->decoder->jsonDecode($this->decoder->base64UrlDecode($data));
     foreach ($claims as $name => &$value) {
         $value = $this->claimFactory->create($name, $value);
     }
     return $claims;
 }