updated-packages
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user