Пример #1
0
 /**
  * @inheritDoc
  */
 public function parseToken($token)
 {
     try {
         $metadata = (array) JWT::decode((string) $token, $this->config->getPublicKey(), [$this->config->getAlgorithm()]);
     } catch (ExpiredException $e) {
         throw InvalidException::tokenExpired($token, $e);
     }
     return new Token($token, $metadata);
 }
Пример #2
0
 /**
  * @param ParsedToken $parsed
  * @throws InvalidException if token validation fails
  */
 protected function validateParsedToken(ParsedToken $parsed)
 {
     if ($parsed->validate($this->validation)) {
         return;
     }
     throw InvalidException::invalidToken((string) $parsed);
 }