static function decode($jwt_string) { $segments = explode('.', $jwt_string); switch (count($segments)) { case 3: $jwt = new self(); $jwt->raw = $jwt_string; $jwt->header = (array) $jwt->extract($segments[0]); $jwt->claims = (array) $jwt->extract($segments[1]); $jwt->signature = $jwt->extract($segments[2], 'as_binary'); return $jwt; case 5: $jwe = new JOSE_JWE($jwt_string); $jwe->auth_data = $segments[0]; $jwe->header = (array) $jwe->extract($segments[0]); $jwe->jwe_encrypted_key = $jwe->extract($segments[1], 'as_binary'); $jwe->iv = $jwe->extract($segments[2], 'as_binary'); $jwe->cipher_text = $jwe->extract($segments[3], 'as_binary'); $jwe->authentication_tag = $jwe->extract($segments[4], 'as_binary'); return $jwe; default: throw new JOSE_Exception_InvalidFormat('JWT should have exact 3 or 5 segments'); } }
public static function run(Event $event) { $magentoDownloader = new self(null, $event->getIO()); $magentoDownloader->download(); $magentoDownloader->extract(); $magentoDownloader->sync(); }