Check that the token is valid.

@param  bool  $getPayload

@return \Afroware\JwTauth\Payload|bool
327125
public function check($getPayload = false)
    {
        try {
            $payload = $this->checkOrFail();
        } catch (JwTException $e) {
            return false;
        }

        return $getPayload ? $payload : true;
    }
1262449
public function verify(JWSInterface $jws, JWKSetInterface $signature_key_set, $detached_payload = null)
    {
        Assertion::inArray($jws->getSignature(0)->getProtectedHeader('alg'), $this->getSupportedSignatureAlgorithms(), sprintf('The signature algorithm "%s" is not supported or not allowed.', $jws->getSignature(0)->getProtectedHeader('alg')));

        $index = null;
        $this->verifier->verifyWithKeySet($jws, $signature_key_set, $detached_payload, $index);
        Assertion::notNull($index, 'JWS signature(s) verification failed.');
        $this->checker_manager->checkJWS($jws, $index);

        return $index;
    }
1296930
function buildPayload(&$payload)
    {
        if (is_array($payload)) {
            $payload = $this->array_map_deep($payload, array($this, 'buildPayloadItemInfo'));
        } else {
            $payload = $this->makePayloadBuilder($payload);
            $this->buildPayload($payload);
        }

        return $payload;
    }
1183580
private function isValidNotification($payload): bool
    {
        if (!is_array($payload)) {
            return false;
        }

        $headerValid = array_key_exists('jsonrpc', $payload) && $payload['jsonrpc'] === '2.0';
        $methodValid = array_key_exists('method', $payload)  && is_string($payload['method']);
        $idValid     = !array_key_exists('id', $payload);

        // This member MAY be omitted
        $paramsValid = true;
        if (array_key_exists('params', $payload) && !is_array($payload['params'])) {
            $paramsValid = false;
        }

        return $headerValid && $methodValid && $paramsValid && $idValid;
    }
771025
public static function create(?string $payload, ?string $encodedPayload = null, bool $isPayloadDetached = false): self
    {
        return new self($payload, $encodedPayload, $isPayloadDetached);
    }
1053459
protected function handlePayload($payload)
    {
        if(is_null($payload)) {
            return $this->buildEmptyResponse();
        }

        if(is_bool($payload)) {
            return $this->buildEmptyResponse();
        }

        if(is_string($payload)) {
            return $this->buildStringResponse($payload);
        }

        return $this->isIlluminateResource($payload)
            ? $this->buildResponse($payload) 
            : $this->buildResponse($this->intoResource($payload));
    }
251098
public function getPayload($token)
    {
        try {
            $jws = SimpleJWS::load($token);

            return $jws->getPayload();
        } catch (\InvalidArgumentException $ex) {
            throw new ProgrammerException('Unable to read jws token.', ProgrammerException::JWS_INVALID_TOKEN_FORMAT);
        }
    }
901978
protected function readPayload($encrypt)
	{
		if (!$encrypt && isset($_GET['jfpayload'])) {
			ob_start();
			$payload = json_decode(trim(base64_decode($_GET['jfpayload'])));
			ob_end_clean();
		} else if ($encrypt && isset($_POST['jfpayload'])) {
			$payload = Api::decrypt($this->key , $_POST['jfpayload']);
		}
		if (isset($payload) && is_array($payload)) {
			$this->payload = $payload;
			return true;
		}
		return false;
	}
1019184
public function determineAccessToken($headerOnly = false)
    {
        if (!empty($this->getRequest()->headers->get('Authorization'))) {
            $accessToken = $this->getTokenType()->determineAccessTokenInHeader($this->getRequest());
        } elseif ($headerOnly === false && (! $this->getTokenType() instanceof MAC)) {
            $accessToken = ($this->getRequest()->server->get('REQUEST_METHOD') === 'GET')
                                ? $this->getRequest()->query->get($this->tokenKey)
                                : $this->getRequest()->request->get($this->tokenKey);
        }

        if (empty($accessToken)) {
            throw new InvalidRequestException('access token');
        }

        return $accessToken;
    }
262361
public function getPayload($key = null)
    {
        if (is_null($key)) {
            return $this->payload;
        }

        return isset($this->payload[$key]) ? $this->payload[$key] : null;
    }
590927
public function getNotifications( $jsonDecodePayload = false )
    {
        $output = array();
        while( $notification = $this->getNotification() ) {
            if( $jsonDecodePayload ) {
                $notification['payload'] = json_decode($notification['payload'], true);
            }
            $output[] = $notification;
        }
        return $output;
    }
1028560
public function verify($token, $identifier = null)
    {
        $identifier = ($identifier !== null) ? $identifier : $this->identifier;

        // Throw error for empty token or empty message id, because the server will not handle this
        if (empty($token)) {
            throw new Totp\EmptyTokenException();
        }
        if (empty($this->identifier)) {
            throw new Totp\EmptyIdentifierException();
        }

        try {
            $this->sendApiCall(self::ACTION_RETRIEVE, sprintf('totp/%s?token=%s', $identifier, $token));
        } catch (Exception $e) {
            if (Totp\Exception::isTotpException($e)) {
                throw new Totp\Exception($e);
            } else {
                throw $e;
            }
        }
    }
982784
public function getPayload($request = null)
    {
        if (!$request) {
            return $this->_payload;
        }

        $payload = null;

        $token = $this->getToken($request);
        if ($token) {
            $payload = $this->_decode($token);
        }

        return $this->_payload = $payload;
    }
1166182
public function checkRevokedToken($token, $payload)
    {
        if(!empty($payload) && Yii::$app->cache)
        {
            return Yii::$app->cache->get($this->getRevokedTokenCacheKey($token)) !== false;
        }
        return false;
    }
1026032
public static function customPayload(array $payload, string $secret): string
    {
        $builder = self::builder();

        foreach ($payload as $key => $value) {
            if (is_int($key)) {
                throw new ValidateException('Invalid payload claim.', 8);
            }

            $builder->setPayloadClaim($key, $value);
        }

        return $builder->setSecret($secret)
            ->build()
            ->getToken();
    }
341079
function post($payload)
    {
        $this->requestDecorator->setPayload($payload);
        $result = $this->client->post($this->requestDecorator->makeResource(), $this->requestDecorator->makePayload(), $this->requestDecorator->makeHeaders());
        $this->refresh();
        return $result;
    }
1254044
public static function simplePayload(array $payload) : array
    {
        $payload = array_filter($payload, function ($val) {
            if ($val instanceof PayloadInterface) {
                $val = $val->getPayload();
            }

            // this will effectively remove empty arrays
            if (is_array($val) && empty($val)) {
                return false;
            }

            if (is_null($val)) {
                return false;
            }

            if ($val === '') {
                return false;
            }

            return true;
        });

        foreach ($payload as $key => $val) {
            if (is_array($val)) {
                $payload[$key] = static::simplePayload($val);
            } elseif ($val instanceof PayloadInterface) {
                $payload[$key] = static::simplePayload($val->getPayload());
            }
        }

        return $payload;
    }