updated-packages

This commit is contained in:
RafficMohammed
2023-01-08 00:13:22 +05:30
parent 3ff7df7487
commit da241bacb6
12659 changed files with 563377 additions and 510538 deletions

View File

@@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2018 Sean Tymon
Copyright (c) Sean Tymon
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@@ -23,22 +23,21 @@
}
],
"require": {
"php": "^5.5.9 || ^7.0",
"illuminate/auth": "5.1.* || 5.2.* || 5.3.* || 5.4.* || 5.5.* || 5.6.* || 5.7.*",
"illuminate/contracts": "5.1.* || 5.2.* || 5.3.* || 5.4.* || 5.5.* || 5.6.* || 5.7.*",
"illuminate/http": "5.1.* || 5.2.* || 5.3.* || 5.4.* || 5.5.* || 5.6.* || 5.7.*",
"illuminate/support": "5.1.* || 5.2.* || 5.3.* || 5.4.* || 5.5.* || 5.6.* || 5.7.*",
"lcobucci/jwt": "^3.2",
"php": "^5.5.9|^7.0",
"illuminate/auth": "^5.2|^6|^7|^8",
"illuminate/contracts": "^5.2|^6|^7|^8",
"illuminate/http": "^5.2|^6|^7|^8",
"illuminate/support": "^5.2|^6|^7|^8",
"lcobucci/jwt": "<3.4",
"namshi/jose": "^7.0",
"nesbot/carbon": "^1.0"
"nesbot/carbon": "^1.0|^2.0"
},
"require-dev": {
"cartalyst/sentinel": "2.0.*",
"illuminate/console": "5.1.* || 5.2.* || 5.3.* || 5.4.* || 5.5.* || 5.6.* || 5.7.*",
"illuminate/database": "5.1.* || 5.2.* || 5.3.* || 5.4.* || 5.5.* || 5.6.* || 5.7.*",
"illuminate/routing": "5.1.* || 5.2.* || 5.3.* || 5.4.* || 5.5.* || 5.6.* || 5.7.*",
"illuminate/console": "^5.2|^6|^7|^8",
"illuminate/database": "^5.2|^6|^7|^8",
"illuminate/routing": "^5.2|^6|^7|^8",
"mockery/mockery": ">=0.9.9",
"phpunit/phpunit": "~4.8 || ~6.0"
"phpunit/phpunit": "~4.8|~6.0"
},
"autoload": {
"psr-4": {
@@ -64,6 +63,12 @@
]
}
},
"funding": [
{
"type": "patreon",
"url": "https://www.patreon.com/seantymon"
}
],
"config": {
"sort-packages": true
},

View File

@@ -11,8 +11,8 @@
namespace Tymon\JWTAuth;
use Tymon\JWTAuth\Support\Utils;
use Tymon\JWTAuth\Contracts\Providers\Storage;
use Tymon\JWTAuth\Support\Utils;
class Blacklist
{
@@ -71,6 +71,11 @@ class Blacklist
return $this->addForever($payload);
}
// if we have already added this token to the blacklist
if (! empty($this->storage->get($this->getKey($payload)))) {
return true;
}
$this->storage->add(
$this->getKey($payload),
['valid_until' => $this->getGraceTimestamp()],
@@ -95,7 +100,7 @@ class Blacklist
// get the latter of the two expiration dates and find
// the number of minutes until the expiration date,
// plus 1 minute to avoid overlap
return $exp->max($iat->addMinutes($this->refreshTTL))->addMinute()->diffInMinutes();
return $exp->max($iat->addMinutes($this->refreshTTL))->addMinute()->diffInRealMinutes();
}
/**

View File

@@ -11,9 +11,9 @@
namespace Tymon\JWTAuth\Claims;
use JsonSerializable;
use Illuminate\Contracts\Support\Jsonable;
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

View File

@@ -11,8 +11,8 @@
namespace Tymon\JWTAuth\Claims;
use Illuminate\Support\Str;
use Illuminate\Support\Collection as IlluminateCollection;
use Illuminate\Support\Str;
class Collection extends IlluminateCollection
{

View File

@@ -13,8 +13,8 @@ namespace Tymon\JWTAuth\Claims;
use DateInterval;
use DateTimeInterface;
use Tymon\JWTAuth\Support\Utils;
use Tymon\JWTAuth\Exceptions\InvalidClaimException;
use Tymon\JWTAuth\Support\Utils;
trait DatetimeTrait
{

View File

@@ -11,8 +11,8 @@
namespace Tymon\JWTAuth\Claims;
use Illuminate\Support\Str;
use Illuminate\Http\Request;
use Illuminate\Support\Str;
use Tymon\JWTAuth\Support\Utils;
class Factory

View File

@@ -11,8 +11,8 @@
namespace Tymon\JWTAuth\Console;
use Illuminate\Support\Str;
use Illuminate\Console\Command;
use Illuminate\Support\Str;
class JWTGenerateSecretCommand extends Command
{
@@ -23,6 +23,7 @@ class JWTGenerateSecretCommand extends Command
*/
protected $signature = 'jwt:secret
{--s|show : Display the key instead of modifying files.}
{--always-no : Skip generating key if it already exists.}
{--f|force : Skip confirmation when overwriting an existing key.}';
/**
@@ -39,7 +40,7 @@ class JWTGenerateSecretCommand extends Command
*/
public function handle()
{
$key = Str::random(32);
$key = Str::random(64);
if ($this->option('show')) {
$this->comment($key);
@@ -52,16 +53,22 @@ class JWTGenerateSecretCommand extends Command
}
if (Str::contains(file_get_contents($path), 'JWT_SECRET') === false) {
// update existing entry
file_put_contents($path, PHP_EOL."JWT_SECRET=$key", FILE_APPEND);
// create new entry
file_put_contents($path, PHP_EOL."JWT_SECRET=$key".PHP_EOL, FILE_APPEND);
} else {
if ($this->option('always-no')) {
$this->comment('Secret key already exists. Skipping...');
return;
}
if ($this->isConfirmed() === false) {
$this->comment('Phew... No changes were made to your secret key.');
return;
}
// create new entry
// update existing entry
file_put_contents($path, str_replace(
'JWT_SECRET='.$this->laravel['config']['jwt.secret'],
'JWT_SECRET='.$key, file_get_contents($path)

View File

@@ -13,10 +13,10 @@ namespace Tymon\JWTAuth;
use Tymon\JWTAuth\Claims\Claim;
use Tymon\JWTAuth\Claims\Collection;
use Tymon\JWTAuth\Support\RefreshFlow;
use Tymon\JWTAuth\Support\CustomClaims;
use Tymon\JWTAuth\Validators\PayloadValidator;
use Tymon\JWTAuth\Claims\Factory as ClaimFactory;
use Tymon\JWTAuth\Support\CustomClaims;
use Tymon\JWTAuth\Support\RefreshFlow;
use Tymon\JWTAuth\Validators\PayloadValidator;
class Factory
{

View File

@@ -11,10 +11,10 @@
namespace Tymon\JWTAuth\Http\Middleware;
use Tymon\JWTAuth\JWTAuth;
use Illuminate\Http\Request;
use Tymon\JWTAuth\Exceptions\JWTException;
use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException;
use Tymon\JWTAuth\Exceptions\JWTException;
use Tymon\JWTAuth\JWTAuth;
abstract class BaseMiddleware
{

View File

@@ -12,8 +12,8 @@
namespace Tymon\JWTAuth\Http\Middleware;
use Closure;
use Tymon\JWTAuth\Exceptions\JWTException;
use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException;
use Tymon\JWTAuth\Exceptions\JWTException;
class RefreshToken extends BaseMiddleware
{

View File

@@ -11,8 +11,8 @@
namespace Tymon\JWTAuth\Http\Parser;
use Illuminate\Support\Arr;
use Illuminate\Http\Request;
use Illuminate\Support\Arr;
class LumenRouteParams extends RouteParams
{

View File

@@ -13,10 +13,10 @@ namespace Tymon\JWTAuth;
use BadMethodCallException;
use Illuminate\Http\Request;
use Tymon\JWTAuth\Http\Parser\Parser;
use Tymon\JWTAuth\Contracts\JWTSubject;
use Tymon\JWTAuth\Support\CustomClaims;
use Tymon\JWTAuth\Exceptions\JWTException;
use Tymon\JWTAuth\Http\Parser\Parser;
use Tymon\JWTAuth\Support\CustomClaims;
class JWT
{

View File

@@ -11,8 +11,8 @@
namespace Tymon\JWTAuth;
use Tymon\JWTAuth\Http\Parser\Parser;
use Tymon\JWTAuth\Contracts\Providers\Auth;
use Tymon\JWTAuth\Http\Parser\Parser;
class JWTAuth extends JWT
{

View File

@@ -12,13 +12,13 @@
namespace Tymon\JWTAuth;
use BadMethodCallException;
use Illuminate\Http\Request;
use Illuminate\Auth\GuardHelpers;
use Illuminate\Contracts\Auth\Guard;
use Tymon\JWTAuth\Contracts\JWTSubject;
use Illuminate\Support\Traits\Macroable;
use Tymon\JWTAuth\Exceptions\JWTException;
use Illuminate\Contracts\Auth\UserProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Traits\Macroable;
use Tymon\JWTAuth\Contracts\JWTSubject;
use Tymon\JWTAuth\Exceptions\JWTException;
use Tymon\JWTAuth\Exceptions\UserNotDefinedException;
class JWTGuard implements Guard

View File

@@ -11,11 +11,11 @@
namespace Tymon\JWTAuth;
use Tymon\JWTAuth\Support\RefreshFlow;
use Tymon\JWTAuth\Support\CustomClaims;
use Tymon\JWTAuth\Contracts\Providers\JWT as JWTContract;
use Tymon\JWTAuth\Exceptions\JWTException;
use Tymon\JWTAuth\Exceptions\TokenBlacklistedException;
use Tymon\JWTAuth\Contracts\Providers\JWT as JWTContract;
use Tymon\JWTAuth\Support\CustomClaims;
use Tymon\JWTAuth\Support\RefreshFlow;
class Manager
{
@@ -169,13 +169,19 @@ class Manager
*/
protected function buildRefreshClaims(Payload $payload)
{
// assign the payload values as variables for use later
extract($payload->toArray());
// Get the claims to be persisted from the payload
$persistentClaims = collect($payload->toArray())
->only($this->persistentClaims)
->toArray();
// persist the relevant claims
return array_merge(
$this->customClaims,
compact($this->persistentClaims, 'sub', 'iat')
$persistentClaims,
[
'sub' => $payload['sub'],
'iat' => $payload['iat'],
]
);
}

View File

@@ -11,15 +11,15 @@
namespace Tymon\JWTAuth;
use Countable;
use ArrayAccess;
use JsonSerializable;
use BadMethodCallException;
use Countable;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Contracts\Support\Jsonable;
use Illuminate\Support\Arr;
use JsonSerializable;
use Tymon\JWTAuth\Claims\Claim;
use Tymon\JWTAuth\Claims\Collection;
use Illuminate\Contracts\Support\Jsonable;
use Illuminate\Contracts\Support\Arrayable;
use Tymon\JWTAuth\Exceptions\PayloadException;
use Tymon\JWTAuth\Validators\PayloadValidator;

View File

@@ -11,34 +11,34 @@
namespace Tymon\JWTAuth\Providers;
use Namshi\JOSE\JWS;
use Tymon\JWTAuth\JWT;
use Tymon\JWTAuth\Factory;
use Tymon\JWTAuth\JWTAuth;
use Tymon\JWTAuth\Manager;
use Tymon\JWTAuth\JWTGuard;
use Tymon\JWTAuth\Blacklist;
use Lcobucci\JWT\Parser as JWTParser;
use Tymon\JWTAuth\Http\Parser\Parser;
use Tymon\JWTAuth\Http\Parser\Cookies;
use Illuminate\Support\ServiceProvider;
use Lcobucci\JWT\Builder as JWTBuilder;
use Tymon\JWTAuth\Providers\JWT\Namshi;
use Tymon\JWTAuth\Http\Middleware\Check;
use Tymon\JWTAuth\Providers\JWT\Lcobucci;
use Tymon\JWTAuth\Http\Parser\AuthHeaders;
use Tymon\JWTAuth\Http\Parser\InputSource;
use Tymon\JWTAuth\Http\Parser\QueryString;
use Tymon\JWTAuth\Http\Parser\RouteParams;
use Tymon\JWTAuth\Contracts\Providers\Auth;
use Tymon\JWTAuth\Contracts\Providers\Storage;
use Tymon\JWTAuth\Validators\PayloadValidator;
use Tymon\JWTAuth\Http\Middleware\Authenticate;
use Tymon\JWTAuth\Http\Middleware\RefreshToken;
use Lcobucci\JWT\Parser as JWTParser;
use Namshi\JOSE\JWS;
use Tymon\JWTAuth\Blacklist;
use Tymon\JWTAuth\Claims\Factory as ClaimFactory;
use Tymon\JWTAuth\Console\JWTGenerateSecretCommand;
use Tymon\JWTAuth\Http\Middleware\AuthenticateAndRenew;
use Tymon\JWTAuth\Contracts\Providers\Auth;
use Tymon\JWTAuth\Contracts\Providers\JWT as JWTContract;
use Tymon\JWTAuth\Contracts\Providers\Storage;
use Tymon\JWTAuth\Factory;
use Tymon\JWTAuth\Http\Middleware\Authenticate;
use Tymon\JWTAuth\Http\Middleware\AuthenticateAndRenew;
use Tymon\JWTAuth\Http\Middleware\Check;
use Tymon\JWTAuth\Http\Middleware\RefreshToken;
use Tymon\JWTAuth\Http\Parser\AuthHeaders;
use Tymon\JWTAuth\Http\Parser\Cookies;
use Tymon\JWTAuth\Http\Parser\InputSource;
use Tymon\JWTAuth\Http\Parser\Parser;
use Tymon\JWTAuth\Http\Parser\QueryString;
use Tymon\JWTAuth\Http\Parser\RouteParams;
use Tymon\JWTAuth\JWT;
use Tymon\JWTAuth\JWTAuth;
use Tymon\JWTAuth\JWTGuard;
use Tymon\JWTAuth\Manager;
use Tymon\JWTAuth\Providers\JWT\Lcobucci;
use Tymon\JWTAuth\Providers\JWT\Namshi;
use Tymon\JWTAuth\Validators\PayloadValidator;
abstract class AbstractServiceProvider extends ServiceProvider
{

View File

@@ -11,8 +11,8 @@
namespace Tymon\JWTAuth\Providers\Auth;
use Tymon\JWTAuth\Contracts\Providers\Auth;
use Illuminate\Contracts\Auth\Guard as GuardContract;
use Tymon\JWTAuth\Contracts\Providers\Auth;
class Illuminate implements Auth
{

View File

@@ -1,77 +0,0 @@
<?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\Providers\Auth;
use Tymon\JWTAuth\Contracts\Providers\Auth;
use Cartalyst\Sentinel\Sentinel as SentinelAuth;
class Sentinel implements Auth
{
/**
* The sentinel authentication.
*
* @var \Cartalyst\Sentinel\Sentinel
*/
protected $sentinel;
/**
* Constructor.
*
* @param \Cartalyst\Sentinel\Sentinel $sentinel
*
* @return void
*/
public function __construct(SentinelAuth $sentinel)
{
$this->sentinel = $sentinel;
}
/**
* Check a user's credentials.
*
* @param array $credentials
*
* @return mixed
*/
public function byCredentials(array $credentials)
{
return $this->sentinel->stateless($credentials);
}
/**
* Authenticate a user via the id.
*
* @param mixed $id
*
* @return bool
*/
public function byId($id)
{
if ($user = $this->sentinel->getUserRepository()->findById($id)) {
$this->sentinel->setUser($user);
return true;
}
return false;
}
/**
* Get the currently authenticated user.
*
* @return \Cartalyst\Sentinel\Users\UserInterface
*/
public function user()
{
return $this->sentinel->getUser();
}
}

View File

@@ -12,24 +12,24 @@
namespace Tymon\JWTAuth\Providers\JWT;
use Exception;
use ReflectionClass;
use Lcobucci\JWT\Parser;
use Lcobucci\JWT\Builder;
use Lcobucci\JWT\Signer\Rsa;
use Lcobucci\JWT\Signer\Ecdsa;
use Lcobucci\JWT\Signer\Keychain;
use Illuminate\Support\Collection;
use Tymon\JWTAuth\Contracts\Providers\JWT;
use Tymon\JWTAuth\Exceptions\JWTException;
use Lcobucci\JWT\Signer\Rsa\Sha256 as RS256;
use Lcobucci\JWT\Signer\Rsa\Sha384 as RS384;
use Lcobucci\JWT\Signer\Rsa\Sha512 as RS512;
use Lcobucci\JWT\Signer\Hmac\Sha256 as HS256;
use Lcobucci\JWT\Signer\Hmac\Sha384 as HS384;
use Lcobucci\JWT\Signer\Hmac\Sha512 as HS512;
use Lcobucci\JWT\Builder;
use Lcobucci\JWT\Parser;
use Lcobucci\JWT\Signer\Ecdsa;
use Lcobucci\JWT\Signer\Ecdsa\Sha256 as ES256;
use Lcobucci\JWT\Signer\Ecdsa\Sha384 as ES384;
use Lcobucci\JWT\Signer\Ecdsa\Sha512 as ES512;
use Lcobucci\JWT\Signer\Hmac\Sha256 as HS256;
use Lcobucci\JWT\Signer\Hmac\Sha384 as HS384;
use Lcobucci\JWT\Signer\Hmac\Sha512 as HS512;
use Lcobucci\JWT\Signer\Keychain;
use Lcobucci\JWT\Signer\Rsa;
use Lcobucci\JWT\Signer\Rsa\Sha256 as RS256;
use Lcobucci\JWT\Signer\Rsa\Sha384 as RS384;
use Lcobucci\JWT\Signer\Rsa\Sha512 as RS512;
use ReflectionClass;
use Tymon\JWTAuth\Contracts\Providers\JWT;
use Tymon\JWTAuth\Exceptions\JWTException;
use Tymon\JWTAuth\Exceptions\TokenInvalidException;
class Lcobucci extends Provider implements JWT

View File

@@ -12,11 +12,11 @@
namespace Tymon\JWTAuth\Providers\JWT;
use Exception;
use InvalidArgumentException;
use Namshi\JOSE\JWS;
use Namshi\JOSE\Signer\OpenSSL\PublicKey;
use ReflectionClass;
use ReflectionException;
use InvalidArgumentException;
use Namshi\JOSE\Signer\OpenSSL\PublicKey;
use Tymon\JWTAuth\Contracts\Providers\JWT;
use Tymon\JWTAuth\Exceptions\JWTException;
use Tymon\JWTAuth\Exceptions\TokenInvalidException;

View File

@@ -28,6 +28,22 @@ class LaravelServiceProvider extends AbstractServiceProvider
$this->extendAuthGuard();
}
/**
* {@inheritdoc}
*/
protected function registerStorageProvider()
{
$this->app->singleton('tymon.jwt.provider.storage', function () {
$instance = $this->getConfigInstance('providers.storage');
if (method_exists($instance, 'setLaravelVersion')) {
$instance->setLaravelVersion($this->app->version());
}
return $instance;
});
}
/**
* Alias the middleware.
*

View File

@@ -13,8 +13,8 @@ namespace Tymon\JWTAuth\Providers;
use Tymon\JWTAuth\Http\Parser\AuthHeaders;
use Tymon\JWTAuth\Http\Parser\InputSource;
use Tymon\JWTAuth\Http\Parser\QueryString;
use Tymon\JWTAuth\Http\Parser\LumenRouteParams;
use Tymon\JWTAuth\Http\Parser\QueryString;
class LumenServiceProvider extends AbstractServiceProvider
{

View File

@@ -12,9 +12,9 @@
namespace Tymon\JWTAuth\Providers\Storage;
use BadMethodCallException;
use Tymon\JWTAuth\Contracts\Providers\Storage;
use Psr\SimpleCache\CacheInterface as PsrCacheInterface;
use Illuminate\Contracts\Cache\Repository as CacheContract;
use Psr\SimpleCache\CacheInterface as PsrCacheInterface;
use Tymon\JWTAuth\Contracts\Providers\Storage;
class Illuminate implements Storage
{
@@ -37,6 +37,11 @@ class Illuminate implements Storage
*/
protected $supportsTags;
/**
* @var string|null
*/
protected $laravelVersion;
/**
* Constructor.
*
@@ -60,6 +65,14 @@ class Illuminate implements Storage
*/
public function add($key, $value, $minutes)
{
// If the laravel version is 5.8 or higher then convert minutes to seconds.
if ($this->laravelVersion !== null
&& is_int($minutes)
&& version_compare($this->laravelVersion, '5.8', '>=')
) {
$minutes = $minutes * 60;
}
$this->cache()->put($key, $value, $minutes);
}
@@ -128,6 +141,16 @@ class Illuminate implements Storage
return $this->cache;
}
/**
* Set the laravel version.
*/
public function setLaravelVersion($version)
{
$this->laravelVersion = $version;
return $this;
}
/**
* Detect as best we can whether tags are supported with this repository & store,
* and save our result on the $supportsTags flag.

View File

@@ -11,9 +11,9 @@
namespace Tymon\JWTAuth\Validators;
use Tymon\JWTAuth\Support\RefreshFlow;
use Tymon\JWTAuth\Exceptions\JWTException;
use Tymon\JWTAuth\Contracts\Validator as ValidatorContract;
use Tymon\JWTAuth\Exceptions\JWTException;
use Tymon\JWTAuth\Support\RefreshFlow;
abstract class Validator implements ValidatorContract
{