File manager - Edit - /home/opticamezl/www/newok/Claim.tar
Back
GreaterOrEqualsTo.php 0000644 00000001427 15173647037 0010646 0 ustar 00 <?php /** * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS * * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause */ namespace Lcobucci\JWT\Claim; use Lcobucci\JWT\Claim; use Lcobucci\JWT\ValidationData; /** * Validatable claim that checks if value is greater or equals the given data * * @deprecated This class will be removed on v4 * * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com> * @since 2.0.0 */ class GreaterOrEqualsTo extends Basic implements Claim, Validatable { /** * {@inheritdoc} */ public function validate(ValidationData $data) { if ($data->has($this->getName())) { return $this->getValue() >= $data->get($this->getName()); } return true; } } Factory.php 0000644 00000006020 15173647037 0006677 0 ustar 00 <?php /** * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS * * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause */ namespace Lcobucci\JWT\Claim; use DateTimeImmutable; use Lcobucci\JWT\Claim; use Lcobucci\JWT\Token\RegisteredClaims; use function current; use function in_array; use function is_array; /** * Class that create claims * * @deprecated This class will be removed on v4 * * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com> * @since 2.0.0 */ class Factory { /** * The list of claim callbacks * * @var array */ private $callbacks; /** * Initializes the factory, registering the default callbacks * * @param array $callbacks */ public function __construct(array $callbacks = []) { $this->callbacks = array_merge( [ 'iat' => [$this, 'createLesserOrEqualsTo'], 'nbf' => [$this, 'createLesserOrEqualsTo'], 'exp' => [$this, 'createGreaterOrEqualsTo'], 'iss' => [$this, 'createEqualsTo'], 'aud' => [$this, 'createEqualsTo'], 'sub' => [$this, 'createEqualsTo'], 'jti' => [$this, 'createEqualsTo'] ], $callbacks ); } /** * Create a new claim * * @param string $name * @param mixed $value * * @return Claim */ public function create($name, $value) { if ($value instanceof DateTimeImmutable && in_array($name, RegisteredClaims::DATE_CLAIMS, true)) { $value = $value->getTimestamp(); } if ($name === RegisteredClaims::AUDIENCE && is_array($value)) { $value = current($value); } if (!empty($this->callbacks[$name])) { return call_user_func($this->callbacks[$name], $name, $value); } return $this->createBasic($name, $value); } /** * Creates a claim that can be compared (greator or equals) * * @param string $name * @param mixed $value * * @return GreaterOrEqualsTo */ private function createGreaterOrEqualsTo($name, $value) { return new GreaterOrEqualsTo($name, $value); } /** * Creates a claim that can be compared (greator or equals) * * @param string $name * @param mixed $value * * @return LesserOrEqualsTo */ private function createLesserOrEqualsTo($name, $value) { return new LesserOrEqualsTo($name, $value); } /** * Creates a claim that can be compared (equals) * * @param string $name * @param mixed $value * * @return EqualsTo */ private function createEqualsTo($name, $value) { return new EqualsTo($name, $value); } /** * Creates a basic claim * * @param string $name * @param mixed $value * * @return Basic */ private function createBasic($name, $value) { return new Basic($name, $value); } } EqualsTo.php 0000644 00000001420 15173647040 0007016 0 ustar 00 <?php /** * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS * * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause */ namespace Lcobucci\JWT\Claim; use Lcobucci\JWT\Claim; use Lcobucci\JWT\ValidationData; /** * Validatable claim that checks if value is strictly equals to the given data * * @deprecated This class will be removed on v4 * * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com> * @since 2.0.0 */ class EqualsTo extends Basic implements Claim, Validatable { /** * {@inheritdoc} */ public function validate(ValidationData $data) { if ($data->has($this->getName())) { return $this->getValue() === $data->get($this->getName()); } return true; } } Validatable.php 0000644 00000001210 15173647040 0007466 0 ustar 00 <?php /** * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS * * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause */ namespace Lcobucci\JWT\Claim; use Lcobucci\JWT\ValidationData; /** * Basic interface for validatable token claims * * @deprecated This interface will be removed on v4 * * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com> * @since 2.0.0 */ interface Validatable { /** * Returns if claim is valid according with given data * * @param ValidationData $data * * @return boolean */ public function validate(ValidationData $data); } LesserOrEqualsTo.php 0000644 00000001430 15173647040 0010476 0 ustar 00 <?php /** * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS * * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause */ namespace Lcobucci\JWT\Claim; use Lcobucci\JWT\Claim; use Lcobucci\JWT\ValidationData; /** * Validatable claim that checks if value is lesser or equals to the given data * * @deprecated This class will be removed on v4 * * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com> * @since 2.0.0 */ class LesserOrEqualsTo extends Basic implements Claim, Validatable { /** * {@inheritdoc} */ public function validate(ValidationData $data) { if ($data->has($this->getName())) { return $this->getValue() <= $data->get($this->getName()); } return true; } } Basic.php 0000644 00000002265 15173647040 0006312 0 ustar 00 <?php /** * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS * * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause */ namespace Lcobucci\JWT\Claim; use Lcobucci\JWT\Claim; /** * The default claim * * @deprecated This class will be removed on v4 * * @author Luís Otávio Cobucci Oblonczyk <lcobucci@gmail.com> * @since 2.0.0 */ class Basic implements Claim { /** * @var string */ private $name; /** * @var mixed */ private $value; /** * Initializes the claim * * @param string $name * @param mixed $value */ public function __construct($name, $value) { $this->name = $name; $this->value = $value; } /** * {@inheritdoc} */ public function getName() { return $this->name; } /** * {@inheritdoc} */ public function getValue() { return $this->value; } /** * {@inheritdoc} */ public function jsonSerialize() { return $this->value; } /** * {@inheritdoc} */ public function __toString() { return (string) $this->value; } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.23 | Generation time: 0 |
proxy
|
phpinfo
|
Settings