One Hat Cyber Team
Your IP:
216.73.216.102
Server IP:
198.54.114.155
Server:
Linux server71.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
Server Software:
LiteSpeed
PHP Version:
5.6.40
Create File
|
Create Folder
Execute
Dir :
~
/
home
/
fluxyjvi
/
public_html
/
assets
/
images
/
Edit File:
Claims.tar
Expiration.php 0000644 00000001204 15107345315 0007400 0 ustar 00 <?php /* * This file is part of jwt-auth. * * (c) Sean Tymon <tymon148@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Tymon\JWTAuth\Claims; use Tymon\JWTAuth\Exceptions\TokenExpiredException; class Expiration extends Claim { use DatetimeTrait; /** * {@inheritdoc} */ protected $name = 'exp'; /** * {@inheritdoc} */ public function validatePayload() { if ($this->isPast($this->getValue())) { throw new TokenExpiredException('Token has expired'); } } } Custom.php 0000644 00000000772 15107345315 0006541 0 ustar 00 <?php /* * This file is part of jwt-auth. * * (c) Sean Tymon <tymon148@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Tymon\JWTAuth\Claims; class Custom extends Claim { /** * @param string $name * @param mixed $value * @return void */ public function __construct($name, $value) { parent::__construct($value); $this->setName($name); } } Collection.php 0000644 00000005206 15107345315 0007357 0 ustar 00 <?php /* * This file is part of jwt-auth. * * (c) Sean Tymon <tymon148@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Tymon\JWTAuth\Claims; use Illuminate\Support\Collection as IlluminateCollection; use Illuminate\Support\Str; class Collection extends IlluminateCollection { /** * Create a new collection. * * @param mixed $items * @return void */ public function __construct($items = []) { parent::__construct($this->getArrayableItems($items)); } /** * Get a Claim instance by it's unique name. * * @param string $name * @param callable $callback * @param mixed $default * @return \Tymon\JWTAuth\Claims\Claim */ public function getByClaimName($name, callable $callback = null, $default = null) { return $this->filter(function (Claim $claim) use ($name) { return $claim->getName() === $name; })->first($callback, $default); } /** * Validate each claim under a given context. * * @param string $context * @return $this */ public function validate($context = 'payload') { $args = func_get_args(); array_shift($args); $this->each(function ($claim) use ($context, $args) { call_user_func_array( [$claim, 'validate'.Str::ucfirst($context)], $args ); }); return $this; } /** * Determine if the Collection contains all of the given keys. * * @param mixed $claims * @return bool */ public function hasAllClaims($claims) { return count($claims) && (new static($claims))->diff($this->keys())->isEmpty(); } /** * Get the claims as key/val array. * * @return array */ public function toPlainArray() { return $this->map(function (Claim $claim) { return $claim->getValue(); })->toArray(); } /** * {@inheritdoc} */ protected function getArrayableItems($items) { return $this->sanitizeClaims($items); } /** * Ensure that the given claims array is keyed by the claim name. * * @param mixed $items * @return array */ private function sanitizeClaims($items) { $claims = []; foreach ($items as $key => $value) { if (! is_string($key) && $value instanceof Claim) { $key = $value->getName(); } $claims[$key] = $value; } return $claims; } } Subject.php 0000644 00000000540 15107345315 0006657 0 ustar 00 <?php /* * This file is part of jwt-auth. * * (c) Sean Tymon <tymon148@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Tymon\JWTAuth\Claims; class Subject extends Claim { /** * {@inheritdoc} */ protected $name = 'sub'; } Factory.php 0000644 00000007747 15107345315 0006707 0 ustar 00 <?php /* * This file is part of jwt-auth. * * (c) Sean Tymon <tymon148@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Tymon\JWTAuth\Claims; use Illuminate\Http\Request; use Illuminate\Support\Str; use Tymon\JWTAuth\Support\Utils; class Factory { /** * The request. * * @var \Illuminate\Http\Request */ protected $request; /** * The TTL. * * @var int */ protected $ttl = 60; /** * Time leeway in seconds. * * @var int */ protected $leeway = 0; /** * The classes map. * * @var array */ private $classMap = [ 'aud' => Audience::class, 'exp' => Expiration::class, 'iat' => IssuedAt::class, 'iss' => Issuer::class, 'jti' => JwtId::class, 'nbf' => NotBefore::class, 'sub' => Subject::class, ]; /** * Constructor. * * @param \Illuminate\Http\Request $request * @return void */ public function __construct(Request $request) { $this->request = $request; } /** * Get the instance of the claim when passing the name and value. * * @param string $name * @param mixed $value * @return \Tymon\JWTAuth\Claims\Claim */ public function get($name, $value) { if ($this->has($name)) { $claim = new $this->classMap[$name]($value); return method_exists($claim, 'setLeeway') ? $claim->setLeeway($this->leeway) : $claim; } return new Custom($name, $value); } /** * Check whether the claim exists. * * @param string $name * @return bool */ public function has($name) { return array_key_exists($name, $this->classMap); } /** * Generate the initial value and return the Claim instance. * * @param string $name * @return \Tymon\JWTAuth\Claims\Claim */ public function make($name) { return $this->get($name, $this->$name()); } /** * Get the Issuer (iss) claim. * * @return string */ public function iss() { return $this->request->url(); } /** * Get the Issued At (iat) claim. * * @return int */ public function iat() { return Utils::now()->getTimestamp(); } /** * Get the Expiration (exp) claim. * * @return int */ public function exp() { return Utils::now()->addMinutes($this->ttl)->getTimestamp(); } /** * Get the Not Before (nbf) claim. * * @return int */ public function nbf() { return Utils::now()->getTimestamp(); } /** * Get the JWT Id (jti) claim. * * @return string */ public function jti() { return Str::random(); } /** * Add a new claim mapping. * * @param string $name * @param string $classPath * @return $this */ public function extend($name, $classPath) { $this->classMap[$name] = $classPath; return $this; } /** * Set the request instance. * * @param \Illuminate\Http\Request $request * @return $this */ public function setRequest(Request $request) { $this->request = $request; return $this; } /** * Set the token ttl (in minutes). * * @param int $ttl * @return $this */ public function setTTL($ttl) { $this->ttl = $ttl; return $this; } /** * Get the token ttl. * * @return int */ public function getTTL() { return $this->ttl; } /** * Set the leeway in seconds. * * @param int $leeway * @return $this */ public function setLeeway($leeway) { $this->leeway = $leeway; return $this; } } Audience.php 0000644 00000000541 15107345315 0006776 0 ustar 00 <?php /* * This file is part of jwt-auth. * * (c) Sean Tymon <tymon148@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Tymon\JWTAuth\Claims; class Audience extends Claim { /** * {@inheritdoc} */ protected $name = 'aud'; } Issuer.php 0000644 00000000537 15107345315 0006540 0 ustar 00 <?php /* * This file is part of jwt-auth. * * (c) Sean Tymon <tymon148@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Tymon\JWTAuth\Claims; class Issuer extends Claim { /** * {@inheritdoc} */ protected $name = 'iss'; } Claim.php 0000644 00000006443 15107345315 0006315 0 ustar 00 <?php /* * This file is part of jwt-auth. * * (c) Sean Tymon <tymon148@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Tymon\JWTAuth\Claims; use Illuminate\Contracts\Support\Arrayable; use Illuminate\Contracts\Support\Jsonable; use JsonSerializable; use Tymon\JWTAuth\Contracts\Claim as ClaimContract; abstract class Claim implements Arrayable, ClaimContract, Jsonable, JsonSerializable { /** * The claim name. * * @var string */ protected $name; /** * The claim value. * * @var mixed */ private $value; /** * @param mixed $value * @return void */ public function __construct($value) { $this->setValue($value); } /** * Set the claim value, and call a validate method. * * @param mixed $value * @return $this * * @throws \Tymon\JWTAuth\Exceptions\InvalidClaimException */ public function setValue($value) { $this->value = $this->validateCreate($value); return $this; } /** * Get the claim value. * * @return mixed */ public function getValue() { return $this->value; } /** * Set the claim name. * * @param string $name * @return $this */ public function setName($name) { $this->name = $name; return $this; } /** * Get the claim name. * * @return string */ public function getName() { return $this->name; } /** * Validate the claim in a standalone Claim context. * * @param mixed $value * @return bool */ public function validateCreate($value) { return $value; } /** * Validate the Claim within a Payload context. * * @return bool */ public function validatePayload() { return $this->getValue(); } /** * Validate the Claim within a refresh context. * * @param int $refreshTTL * @return bool */ public function validateRefresh($refreshTTL) { return $this->getValue(); } /** * Checks if the value matches the claim. * * @param mixed $value * @param bool $strict * @return bool */ public function matches($value, $strict = true) { return $strict ? $this->value === $value : $this->value == $value; } /** * Convert the object into something JSON serializable. * * @return array */ #[\ReturnTypeWillChange] public function jsonSerialize() { return $this->toArray(); } /** * Build a key value array comprising of the claim name and value. * * @return array */ public function toArray() { return [$this->getName() => $this->getValue()]; } /** * Get the claim as JSON. * * @param int $options * @return string */ public function toJson($options = JSON_UNESCAPED_SLASHES) { return json_encode($this->toArray(), $options); } /** * Get the payload as a string. * * @return string */ public function __toString() { return $this->toJson(); } } IssuedAt.php 0000644 00000002534 15107345315 0007006 0 ustar 00 <?php /* * This file is part of jwt-auth. * * (c) Sean Tymon <tymon148@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Tymon\JWTAuth\Claims; use Tymon\JWTAuth\Exceptions\InvalidClaimException; use Tymon\JWTAuth\Exceptions\TokenExpiredException; use Tymon\JWTAuth\Exceptions\TokenInvalidException; class IssuedAt extends Claim { use DatetimeTrait { validateCreate as commonValidateCreate; } /** * {@inheritdoc} */ protected $name = 'iat'; /** * {@inheritdoc} */ public function validateCreate($value) { $this->commonValidateCreate($value); if ($this->isFuture($value)) { throw new InvalidClaimException($this); } return $value; } /** * {@inheritdoc} */ public function validatePayload() { if ($this->isFuture($this->getValue())) { throw new TokenInvalidException('Issued At (iat) timestamp cannot be in the future'); } } /** * {@inheritdoc} */ public function validateRefresh($refreshTTL) { if ($this->isPast($this->getValue() + $refreshTTL * 60)) { throw new TokenExpiredException('Token has expired and can no longer be refreshed'); } } } NotBefore.php 0000644 00000001246 15107345315 0007147 0 ustar 00 <?php /* * This file is part of jwt-auth. * * (c) Sean Tymon <tymon148@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Tymon\JWTAuth\Claims; use Tymon\JWTAuth\Exceptions\TokenInvalidException; class NotBefore extends Claim { use DatetimeTrait; /** * {@inheritdoc} */ protected $name = 'nbf'; /** * {@inheritdoc} */ public function validatePayload() { if ($this->isFuture($this->getValue())) { throw new TokenInvalidException('Not Before (nbf) timestamp cannot be in the future'); } } } DatetimeTrait.php 0000644 00000003545 15107345315 0010030 0 ustar 00 <?php /* * This file is part of jwt-auth. * * (c) Sean Tymon <tymon148@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Tymon\JWTAuth\Claims; use DateInterval; use DateTimeInterface; use Tymon\JWTAuth\Exceptions\InvalidClaimException; use Tymon\JWTAuth\Support\Utils; trait DatetimeTrait { /** * Time leeway in seconds. * * @var int */ protected $leeway = 0; /** * Set the claim value, and call a validate method. * * @param mixed $value * @return $this * * @throws \Tymon\JWTAuth\Exceptions\InvalidClaimException */ public function setValue($value) { if ($value instanceof DateInterval) { $value = Utils::now()->add($value); } if ($value instanceof DateTimeInterface) { $value = $value->getTimestamp(); } return parent::setValue($value); } /** * {@inheritdoc} */ public function validateCreate($value) { if (! is_numeric($value)) { throw new InvalidClaimException($this); } return $value; } /** * Determine whether the value is in the future. * * @param mixed $value * @return bool */ protected function isFuture($value) { return Utils::isFuture($value, $this->leeway); } /** * Determine whether the value is in the past. * * @param mixed $value * @return bool */ protected function isPast($value) { return Utils::isPast($value, $this->leeway); } /** * Set the leeway in seconds. * * @param int $leeway * @return $this */ public function setLeeway($leeway) { $this->leeway = $leeway; return $this; } } JwtId.php 0000644 00000000536 15107345315 0006306 0 ustar 00 <?php /* * This file is part of jwt-auth. * * (c) Sean Tymon <tymon148@gmail.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Tymon\JWTAuth\Claims; class JwtId extends Claim { /** * {@inheritdoc} */ protected $name = 'jti'; }
Simpan