package and depencies
This commit is contained in:
10
vendor/tymon/jwt-auth/src/Blacklist.php
vendored
10
vendor/tymon/jwt-auth/src/Blacklist.php
vendored
@@ -48,7 +48,6 @@ class Blacklist
|
||||
* Constructor.
|
||||
*
|
||||
* @param \Tymon\JWTAuth\Contracts\Providers\Storage $storage
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Storage $storage)
|
||||
@@ -60,7 +59,6 @@ class Blacklist
|
||||
* Add the token (jti claim) to the blacklist.
|
||||
*
|
||||
* @param \Tymon\JWTAuth\Payload $payload
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function add(Payload $payload)
|
||||
@@ -89,7 +87,6 @@ class Blacklist
|
||||
* Get the number of minutes until the token expiry.
|
||||
*
|
||||
* @param \Tymon\JWTAuth\Payload $payload
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
protected function getMinutesUntilExpired(Payload $payload)
|
||||
@@ -107,7 +104,6 @@ class Blacklist
|
||||
* Add the token (jti claim) to the blacklist indefinitely.
|
||||
*
|
||||
* @param \Tymon\JWTAuth\Payload $payload
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function addForever(Payload $payload)
|
||||
@@ -121,7 +117,6 @@ class Blacklist
|
||||
* Determine whether the token has been blacklisted.
|
||||
*
|
||||
* @param \Tymon\JWTAuth\Payload $payload
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function has(Payload $payload)
|
||||
@@ -141,7 +136,6 @@ class Blacklist
|
||||
* Remove the token (jti claim) from the blacklist.
|
||||
*
|
||||
* @param \Tymon\JWTAuth\Payload $payload
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function remove(Payload $payload)
|
||||
@@ -176,7 +170,6 @@ class Blacklist
|
||||
* Set the grace period.
|
||||
*
|
||||
* @param int $gracePeriod
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setGracePeriod($gracePeriod)
|
||||
@@ -200,7 +193,6 @@ class Blacklist
|
||||
* Get the unique key held within the blacklist.
|
||||
*
|
||||
* @param \Tymon\JWTAuth\Payload $payload
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getKey(Payload $payload)
|
||||
@@ -212,7 +204,6 @@ class Blacklist
|
||||
* Set the unique key held within the blacklist.
|
||||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setKey($key)
|
||||
@@ -226,7 +217,6 @@ class Blacklist
|
||||
* Set the refresh time limit.
|
||||
*
|
||||
* @param int $ttl
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setRefreshTTL($ttl)
|
||||
|
||||
10
vendor/tymon/jwt-auth/src/Claims/Claim.php
vendored
10
vendor/tymon/jwt-auth/src/Claims/Claim.php
vendored
@@ -34,7 +34,6 @@ abstract class Claim implements Arrayable, ClaimContract, Jsonable, JsonSerializ
|
||||
|
||||
/**
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($value)
|
||||
@@ -46,10 +45,9 @@ abstract class Claim implements Arrayable, ClaimContract, Jsonable, JsonSerializ
|
||||
* Set the claim value, and call a validate method.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return $this
|
||||
*
|
||||
* @throws \Tymon\JWTAuth\Exceptions\InvalidClaimException
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
@@ -72,7 +70,6 @@ abstract class Claim implements Arrayable, ClaimContract, Jsonable, JsonSerializ
|
||||
* Set the claim name.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setName($name)
|
||||
@@ -96,7 +93,6 @@ abstract class Claim implements Arrayable, ClaimContract, Jsonable, JsonSerializ
|
||||
* Validate the claim in a standalone Claim context.
|
||||
*
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function validateCreate($value)
|
||||
@@ -118,7 +114,6 @@ abstract class Claim implements Arrayable, ClaimContract, Jsonable, JsonSerializ
|
||||
* Validate the Claim within a refresh context.
|
||||
*
|
||||
* @param int $refreshTTL
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function validateRefresh($refreshTTL)
|
||||
@@ -131,7 +126,6 @@ abstract class Claim implements Arrayable, ClaimContract, Jsonable, JsonSerializ
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param bool $strict
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function matches($value, $strict = true)
|
||||
@@ -144,6 +138,7 @@ abstract class Claim implements Arrayable, ClaimContract, Jsonable, JsonSerializ
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return $this->toArray();
|
||||
@@ -163,7 +158,6 @@ abstract class Claim implements Arrayable, ClaimContract, Jsonable, JsonSerializ
|
||||
* Get the claim as JSON.
|
||||
*
|
||||
* @param int $options
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toJson($options = JSON_UNESCAPED_SLASHES)
|
||||
|
||||
@@ -20,7 +20,6 @@ class Collection extends IlluminateCollection
|
||||
* Create a new collection.
|
||||
*
|
||||
* @param mixed $items
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($items = [])
|
||||
@@ -34,7 +33,6 @@ class Collection extends IlluminateCollection
|
||||
* @param string $name
|
||||
* @param callable $callback
|
||||
* @param mixed $default
|
||||
*
|
||||
* @return \Tymon\JWTAuth\Claims\Claim
|
||||
*/
|
||||
public function getByClaimName($name, callable $callback = null, $default = null)
|
||||
@@ -48,7 +46,6 @@ class Collection extends IlluminateCollection
|
||||
* Validate each claim under a given context.
|
||||
*
|
||||
* @param string $context
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function validate($context = 'payload')
|
||||
@@ -70,7 +67,6 @@ class Collection extends IlluminateCollection
|
||||
* Determine if the Collection contains all of the given keys.
|
||||
*
|
||||
* @param mixed $claims
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasAllClaims($claims)
|
||||
@@ -102,7 +98,6 @@ class Collection extends IlluminateCollection
|
||||
* Ensure that the given claims array is keyed by the claim name.
|
||||
*
|
||||
* @param mixed $items
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function sanitizeClaims($items)
|
||||
|
||||
1
vendor/tymon/jwt-auth/src/Claims/Custom.php
vendored
1
vendor/tymon/jwt-auth/src/Claims/Custom.php
vendored
@@ -16,7 +16,6 @@ class Custom extends Claim
|
||||
/**
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($name, $value)
|
||||
|
||||
@@ -29,10 +29,9 @@ trait DatetimeTrait
|
||||
* Set the claim value, and call a validate method.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return $this
|
||||
*
|
||||
* @throws \Tymon\JWTAuth\Exceptions\InvalidClaimException
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
@@ -63,7 +62,6 @@ trait DatetimeTrait
|
||||
* Determine whether the value is in the future.
|
||||
*
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function isFuture($value)
|
||||
@@ -75,7 +73,6 @@ trait DatetimeTrait
|
||||
* Determine whether the value is in the past.
|
||||
*
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function isPast($value)
|
||||
@@ -87,7 +84,6 @@ trait DatetimeTrait
|
||||
* Set the leeway in seconds.
|
||||
*
|
||||
* @param int $leeway
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setLeeway($leeway)
|
||||
|
||||
8
vendor/tymon/jwt-auth/src/Claims/Factory.php
vendored
8
vendor/tymon/jwt-auth/src/Claims/Factory.php
vendored
@@ -57,7 +57,6 @@ class Factory
|
||||
* Constructor.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Request $request)
|
||||
@@ -70,7 +69,6 @@ class Factory
|
||||
*
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return \Tymon\JWTAuth\Claims\Claim
|
||||
*/
|
||||
public function get($name, $value)
|
||||
@@ -90,7 +88,6 @@ class Factory
|
||||
* Check whether the claim exists.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function has($name)
|
||||
@@ -102,7 +99,6 @@ class Factory
|
||||
* Generate the initial value and return the Claim instance.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return \Tymon\JWTAuth\Claims\Claim
|
||||
*/
|
||||
public function make($name)
|
||||
@@ -165,7 +161,6 @@ class Factory
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $classPath
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function extend($name, $classPath)
|
||||
@@ -179,7 +174,6 @@ class Factory
|
||||
* Set the request instance.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setRequest(Request $request)
|
||||
@@ -193,7 +187,6 @@ class Factory
|
||||
* Set the token ttl (in minutes).
|
||||
*
|
||||
* @param int $ttl
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setTTL($ttl)
|
||||
@@ -217,7 +210,6 @@ class Factory
|
||||
* Set the leeway in seconds.
|
||||
*
|
||||
* @param int $leeway
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setLeeway($leeway)
|
||||
|
||||
@@ -82,7 +82,6 @@ class JWTGenerateSecretCommand extends Command
|
||||
* Display the key.
|
||||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function displayKey($key)
|
||||
|
||||
@@ -17,10 +17,9 @@ interface Claim
|
||||
* Set the claim value, and call a validate method.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return $this
|
||||
*
|
||||
* @throws \Tymon\JWTAuth\Exceptions\InvalidClaimException
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setValue($value);
|
||||
|
||||
@@ -35,7 +34,6 @@ interface Claim
|
||||
* Set the claim name.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setName($name);
|
||||
@@ -51,7 +49,6 @@ interface Claim
|
||||
* Validate the Claim value.
|
||||
*
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function validateCreate($value);
|
||||
|
||||
@@ -19,7 +19,6 @@ interface Parser
|
||||
* Parse the request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
public function parse(Request $request);
|
||||
|
||||
@@ -17,7 +17,6 @@ interface Auth
|
||||
* Check a user's credentials.
|
||||
*
|
||||
* @param array $credentials
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function byCredentials(array $credentials);
|
||||
@@ -26,7 +25,6 @@ interface Auth
|
||||
* Authenticate a user via the id.
|
||||
*
|
||||
* @param mixed $id
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function byId($id);
|
||||
|
||||
@@ -15,14 +15,12 @@ interface JWT
|
||||
{
|
||||
/**
|
||||
* @param array $payload
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function encode(array $payload);
|
||||
|
||||
/**
|
||||
* @param string $token
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function decode($token);
|
||||
|
||||
@@ -17,7 +17,6 @@ interface Storage
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @param int $minutes
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function add($key, $value, $minutes);
|
||||
@@ -25,21 +24,18 @@ interface Storage
|
||||
/**
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function forever($key, $value);
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function get($key);
|
||||
|
||||
/**
|
||||
* @param string $key
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function destroy($key);
|
||||
|
||||
@@ -17,7 +17,6 @@ interface Validator
|
||||
* Perform some checks on the value.
|
||||
*
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function check($value);
|
||||
@@ -26,7 +25,6 @@ interface Validator
|
||||
* Helper function to return a boolean.
|
||||
*
|
||||
* @param array $value
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isValid($value);
|
||||
|
||||
@@ -22,7 +22,6 @@ class InvalidClaimException extends JWTException
|
||||
* @param \Tymon\JWTAuth\Claims\Claim $claim
|
||||
* @param int $code
|
||||
* @param \Exception|null $previous
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Claim $claim, $code = 0, Exception $previous = null)
|
||||
|
||||
8
vendor/tymon/jwt-auth/src/Factory.php
vendored
8
vendor/tymon/jwt-auth/src/Factory.php
vendored
@@ -61,7 +61,6 @@ class Factory
|
||||
*
|
||||
* @param \Tymon\JWTAuth\Claims\Factory $claimFactory
|
||||
* @param \Tymon\JWTAuth\Validators\PayloadValidator $validator
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(ClaimFactory $claimFactory, PayloadValidator $validator)
|
||||
@@ -75,7 +74,6 @@ class Factory
|
||||
* Create the Payload instance.
|
||||
*
|
||||
* @param bool $resetClaims
|
||||
*
|
||||
* @return \Tymon\JWTAuth\Payload
|
||||
*/
|
||||
public function make($resetClaims = false)
|
||||
@@ -103,7 +101,6 @@ class Factory
|
||||
* Add an array of claims to the Payload.
|
||||
*
|
||||
* @param array $claims
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
protected function addClaims(array $claims)
|
||||
@@ -120,7 +117,6 @@ class Factory
|
||||
*
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
protected function addClaim($name, $value)
|
||||
@@ -177,7 +173,6 @@ class Factory
|
||||
* Get a Payload instance with a claims collection.
|
||||
*
|
||||
* @param \Tymon\JWTAuth\Claims\Collection $claims
|
||||
*
|
||||
* @return \Tymon\JWTAuth\Payload
|
||||
*/
|
||||
public function withClaims(Collection $claims)
|
||||
@@ -189,7 +184,6 @@ class Factory
|
||||
* Set the default claims to be added to the Payload.
|
||||
*
|
||||
* @param array $claims
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setDefaultClaims(array $claims)
|
||||
@@ -203,7 +197,6 @@ class Factory
|
||||
* Helper to set the ttl.
|
||||
*
|
||||
* @param int $ttl
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setTTL($ttl)
|
||||
@@ -248,7 +241,6 @@ class Factory
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $parameters
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function __call($method, $parameters)
|
||||
|
||||
@@ -13,6 +13,7 @@ namespace Tymon\JWTAuth\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
|
||||
/** @deprecated */
|
||||
class Authenticate extends BaseMiddleware
|
||||
{
|
||||
/**
|
||||
@@ -20,10 +21,9 @@ class Authenticate extends BaseMiddleware
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
|
||||
@@ -13,6 +13,7 @@ namespace Tymon\JWTAuth\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
|
||||
/** @deprecated */
|
||||
class AuthenticateAndRenew extends BaseMiddleware
|
||||
{
|
||||
/**
|
||||
@@ -20,10 +21,9 @@ class AuthenticateAndRenew extends BaseMiddleware
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
|
||||
@@ -16,6 +16,7 @@ use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException;
|
||||
use Tymon\JWTAuth\Exceptions\JWTException;
|
||||
use Tymon\JWTAuth\JWTAuth;
|
||||
|
||||
/** @deprecated */
|
||||
abstract class BaseMiddleware
|
||||
{
|
||||
/**
|
||||
@@ -29,7 +30,6 @@ abstract class BaseMiddleware
|
||||
* Create a new BaseMiddleware instance.
|
||||
*
|
||||
* @param \Tymon\JWTAuth\JWTAuth $auth
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(JWTAuth $auth)
|
||||
@@ -41,10 +41,9 @@ abstract class BaseMiddleware
|
||||
* Check the request for the presence of a token.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return void
|
||||
*
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\BadRequestHttpException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function checkForToken(Request $request)
|
||||
{
|
||||
@@ -57,10 +56,9 @@ abstract class BaseMiddleware
|
||||
* Attempt to authenticate a user via the token in the request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return void
|
||||
*
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function authenticate(Request $request)
|
||||
{
|
||||
@@ -80,7 +78,6 @@ abstract class BaseMiddleware
|
||||
*
|
||||
* @param \Illuminate\Http\Response|\Illuminate\Http\JsonResponse $response
|
||||
* @param string|null $token
|
||||
*
|
||||
* @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse
|
||||
*/
|
||||
protected function setAuthenticationHeader($response, $token = null)
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace Tymon\JWTAuth\Http\Middleware;
|
||||
use Closure;
|
||||
use Exception;
|
||||
|
||||
/** @deprecated */
|
||||
class Check extends BaseMiddleware
|
||||
{
|
||||
/**
|
||||
@@ -21,7 +22,6 @@ class Check extends BaseMiddleware
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
|
||||
@@ -15,6 +15,7 @@ use Closure;
|
||||
use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException;
|
||||
use Tymon\JWTAuth\Exceptions\JWTException;
|
||||
|
||||
/** @deprecated */
|
||||
class RefreshToken extends BaseMiddleware
|
||||
{
|
||||
/**
|
||||
@@ -22,10 +23,9 @@ class RefreshToken extends BaseMiddleware
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
|
||||
@@ -34,7 +34,6 @@ class AuthHeaders implements ParserContract
|
||||
* Attempt to parse the token from some other possible headers.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
protected function fromAltHeaders(Request $request)
|
||||
@@ -46,23 +45,31 @@ class AuthHeaders implements ParserContract
|
||||
* Try to parse the token from the request header.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
public function parse(Request $request)
|
||||
{
|
||||
$header = $request->headers->get($this->header) ?: $this->fromAltHeaders($request);
|
||||
|
||||
if ($header && preg_match('/'.$this->prefix.'\s*(\S+)\b/i', $header, $matches)) {
|
||||
return $matches[1];
|
||||
if ($header !== null) {
|
||||
$position = strripos($header, $this->prefix);
|
||||
|
||||
if ($position !== false) {
|
||||
$header = substr($header, $position + strlen($this->prefix));
|
||||
|
||||
return trim(
|
||||
strpos($header, ',') !== false ? strstr($header, ',', true) : $header
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the header name.
|
||||
*
|
||||
* @param string $headerName
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setHeaderName($headerName)
|
||||
@@ -76,7 +83,6 @@ class AuthHeaders implements ParserContract
|
||||
* Set the header prefix.
|
||||
*
|
||||
* @param string $headerPrefix
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setHeaderPrefix($headerPrefix)
|
||||
|
||||
@@ -35,7 +35,6 @@ class Cookies implements ParserContract
|
||||
* Try to parse the token from the request cookies.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
public function parse(Request $request)
|
||||
|
||||
@@ -22,7 +22,6 @@ class InputSource implements ParserContract
|
||||
* Try to parse the token from the request input source.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
public function parse(Request $request)
|
||||
|
||||
@@ -24,7 +24,6 @@ trait KeyTrait
|
||||
* Set the key.
|
||||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setKey($key)
|
||||
|
||||
@@ -20,7 +20,6 @@ class LumenRouteParams extends RouteParams
|
||||
* Try to get the token from the route parameters.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
public function parse(Request $request)
|
||||
|
||||
17
vendor/tymon/jwt-auth/src/Http/Parser/Parser.php
vendored
17
vendor/tymon/jwt-auth/src/Http/Parser/Parser.php
vendored
@@ -34,7 +34,6 @@ class Parser
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param array $chain
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Request $request, array $chain = [])
|
||||
@@ -53,11 +52,23 @@ class Parser
|
||||
return $this->chain;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new parser to the chain.
|
||||
*
|
||||
* @param array|\Tymon\JWTAuth\Contracts\Http\Parser $parsers
|
||||
* @return $this
|
||||
*/
|
||||
public function addParser($parsers)
|
||||
{
|
||||
$this->chain = array_merge($this->chain, is_array($parsers) ? $parsers : [$parsers]);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the order of the parser chain.
|
||||
*
|
||||
* @param array $chain
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setChain(array $chain)
|
||||
@@ -71,7 +82,6 @@ class Parser
|
||||
* Alias for setting the order of the chain.
|
||||
*
|
||||
* @param array $chain
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setChainOrder(array $chain)
|
||||
@@ -108,7 +118,6 @@ class Parser
|
||||
* Set the request instance.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setRequest(Request $request)
|
||||
|
||||
@@ -22,7 +22,6 @@ class QueryString implements ParserContract
|
||||
* Try to parse the token from the request query string.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
public function parse(Request $request)
|
||||
|
||||
@@ -22,7 +22,6 @@ class RouteParams implements ParserContract
|
||||
* Try to get the token from the route parameters.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
public function parse(Request $request)
|
||||
|
||||
30
vendor/tymon/jwt-auth/src/JWT.php
vendored
30
vendor/tymon/jwt-auth/src/JWT.php
vendored
@@ -55,7 +55,6 @@ class JWT
|
||||
*
|
||||
* @param \Tymon\JWTAuth\Manager $manager
|
||||
* @param \Tymon\JWTAuth\Http\Parser\Parser $parser
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Manager $manager, Parser $parser)
|
||||
@@ -68,7 +67,6 @@ class JWT
|
||||
* Generate a token for a given subject.
|
||||
*
|
||||
* @param \Tymon\JWTAuth\Contracts\JWTSubject $subject
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function fromSubject(JWTSubject $subject)
|
||||
@@ -82,7 +80,6 @@ class JWT
|
||||
* Alias to generate a token for a given user.
|
||||
*
|
||||
* @param \Tymon\JWTAuth\Contracts\JWTSubject $user
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function fromUser(JWTSubject $user)
|
||||
@@ -95,7 +92,6 @@ class JWT
|
||||
*
|
||||
* @param bool $forceForever
|
||||
* @param bool $resetClaims
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function refresh($forceForever = false, $resetClaims = false)
|
||||
@@ -111,7 +107,6 @@ class JWT
|
||||
* Invalidate a token (add it to the blacklist).
|
||||
*
|
||||
* @param bool $forceForever
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function invalidate($forceForever = false)
|
||||
@@ -127,9 +122,9 @@ class JWT
|
||||
* Alias to get the payload, and as a result checks that
|
||||
* the token is valid i.e. not expired or blacklisted.
|
||||
*
|
||||
* @throws \Tymon\JWTAuth\Exceptions\JWTException
|
||||
*
|
||||
* @return \Tymon\JWTAuth\Payload
|
||||
*
|
||||
* @throws \Tymon\JWTAuth\Exceptions\JWTException
|
||||
*/
|
||||
public function checkOrFail()
|
||||
{
|
||||
@@ -140,7 +135,6 @@ class JWT
|
||||
* Check that the token is valid.
|
||||
*
|
||||
* @param bool $getPayload
|
||||
*
|
||||
* @return \Tymon\JWTAuth\Payload|bool
|
||||
*/
|
||||
public function check($getPayload = false)
|
||||
@@ -175,9 +169,9 @@ class JWT
|
||||
/**
|
||||
* Parse the token from the request.
|
||||
*
|
||||
* @throws \Tymon\JWTAuth\Exceptions\JWTException
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @throws \Tymon\JWTAuth\Exceptions\JWTException
|
||||
*/
|
||||
public function parseToken()
|
||||
{
|
||||
@@ -214,7 +208,6 @@ class JWT
|
||||
* Convenience method to get a claim value.
|
||||
*
|
||||
* @param string $claim
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getClaim($claim)
|
||||
@@ -226,7 +219,6 @@ class JWT
|
||||
* Create a Payload instance.
|
||||
*
|
||||
* @param \Tymon\JWTAuth\Contracts\JWTSubject $subject
|
||||
*
|
||||
* @return \Tymon\JWTAuth\Payload
|
||||
*/
|
||||
public function makePayload(JWTSubject $subject)
|
||||
@@ -238,7 +230,6 @@ class JWT
|
||||
* Build the claims array and return it.
|
||||
*
|
||||
* @param \Tymon\JWTAuth\Contracts\JWTSubject $subject
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getClaimsArray(JWTSubject $subject)
|
||||
@@ -254,7 +245,6 @@ class JWT
|
||||
* Get the claims associated with a given subject.
|
||||
*
|
||||
* @param \Tymon\JWTAuth\Contracts\JWTSubject $subject
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getClaimsForSubject(JWTSubject $subject)
|
||||
@@ -268,7 +258,6 @@ class JWT
|
||||
* Hash the subject model and return it.
|
||||
*
|
||||
* @param string|object $model
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function hashSubjectModel($model)
|
||||
@@ -280,7 +269,6 @@ class JWT
|
||||
* Check if the subject model matches the one saved in the token.
|
||||
*
|
||||
* @param string|object $model
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function checkSubjectModel($model)
|
||||
@@ -296,7 +284,6 @@ class JWT
|
||||
* Set the token.
|
||||
*
|
||||
* @param \Tymon\JWTAuth\Token|string $token
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setToken($token)
|
||||
@@ -321,9 +308,9 @@ class JWT
|
||||
/**
|
||||
* Ensure that a token is available.
|
||||
*
|
||||
* @throws \Tymon\JWTAuth\Exceptions\JWTException
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws \Tymon\JWTAuth\Exceptions\JWTException
|
||||
*/
|
||||
protected function requireToken()
|
||||
{
|
||||
@@ -336,7 +323,6 @@ class JWT
|
||||
* Set the request instance.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setRequest(Request $request)
|
||||
@@ -350,7 +336,6 @@ class JWT
|
||||
* Set whether the subject should be "locked".
|
||||
*
|
||||
* @param bool $lock
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function lockSubject($lock)
|
||||
@@ -405,10 +390,9 @@ class JWT
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $parameters
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \BadMethodCallException
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call($method, $parameters)
|
||||
{
|
||||
|
||||
3
vendor/tymon/jwt-auth/src/JWTAuth.php
vendored
3
vendor/tymon/jwt-auth/src/JWTAuth.php
vendored
@@ -14,6 +14,7 @@ namespace Tymon\JWTAuth;
|
||||
use Tymon\JWTAuth\Contracts\Providers\Auth;
|
||||
use Tymon\JWTAuth\Http\Parser\Parser;
|
||||
|
||||
/** @deprecated */
|
||||
class JWTAuth extends JWT
|
||||
{
|
||||
/**
|
||||
@@ -29,7 +30,6 @@ class JWTAuth extends JWT
|
||||
* @param \Tymon\JWTAuth\Manager $manager
|
||||
* @param \Tymon\JWTAuth\Contracts\Providers\Auth $auth
|
||||
* @param \Tymon\JWTAuth\Http\Parser\Parser $parser
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Manager $manager, Auth $auth, Parser $parser)
|
||||
@@ -42,7 +42,6 @@ class JWTAuth extends JWT
|
||||
* Attempt to authenticate the user and return the token.
|
||||
*
|
||||
* @param array $credentials
|
||||
*
|
||||
* @return false|string
|
||||
*/
|
||||
public function attempt(array $credentials)
|
||||
|
||||
30
vendor/tymon/jwt-auth/src/JWTGuard.php
vendored
30
vendor/tymon/jwt-auth/src/JWTGuard.php
vendored
@@ -54,7 +54,6 @@ class JWTGuard implements Guard
|
||||
* @param \Tymon\JWTAuth\JWT $jwt
|
||||
* @param \Illuminate\Contracts\Auth\UserProvider $provider
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(JWT $jwt, UserProvider $provider, Request $request)
|
||||
@@ -86,9 +85,9 @@ class JWTGuard implements Guard
|
||||
/**
|
||||
* Get the currently authenticated user or throws an exception.
|
||||
*
|
||||
* @throws \Tymon\JWTAuth\Exceptions\UserNotDefinedException
|
||||
*
|
||||
* @return \Illuminate\Contracts\Auth\Authenticatable
|
||||
*
|
||||
* @throws \Tymon\JWTAuth\Exceptions\UserNotDefinedException
|
||||
*/
|
||||
public function userOrFail()
|
||||
{
|
||||
@@ -103,7 +102,6 @@ class JWTGuard implements Guard
|
||||
* Validate a user's credentials.
|
||||
*
|
||||
* @param array $credentials
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function validate(array $credentials = [])
|
||||
@@ -116,7 +114,6 @@ class JWTGuard implements Guard
|
||||
*
|
||||
* @param array $credentials
|
||||
* @param bool $login
|
||||
*
|
||||
* @return bool|string
|
||||
*/
|
||||
public function attempt(array $credentials = [], $login = true)
|
||||
@@ -134,7 +131,6 @@ class JWTGuard implements Guard
|
||||
* Create a token for a user.
|
||||
*
|
||||
* @param \Tymon\JWTAuth\Contracts\JWTSubject $user
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function login(JWTSubject $user)
|
||||
@@ -149,7 +145,6 @@ class JWTGuard implements Guard
|
||||
* Logout the user, thus invalidating the token.
|
||||
*
|
||||
* @param bool $forceForever
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function logout($forceForever = false)
|
||||
@@ -165,7 +160,6 @@ class JWTGuard implements Guard
|
||||
*
|
||||
* @param bool $forceForever
|
||||
* @param bool $resetClaims
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function refresh($forceForever = false, $resetClaims = false)
|
||||
@@ -177,7 +171,6 @@ class JWTGuard implements Guard
|
||||
* Invalidate the token.
|
||||
*
|
||||
* @param bool $forceForever
|
||||
*
|
||||
* @return \Tymon\JWTAuth\JWT
|
||||
*/
|
||||
public function invalidate($forceForever = false)
|
||||
@@ -189,7 +182,6 @@ class JWTGuard implements Guard
|
||||
* Create a new token by User id.
|
||||
*
|
||||
* @param mixed $id
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function tokenById($id)
|
||||
@@ -203,7 +195,6 @@ class JWTGuard implements Guard
|
||||
* Log a user into the application using their credentials.
|
||||
*
|
||||
* @param array $credentials
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function once(array $credentials = [])
|
||||
@@ -221,7 +212,6 @@ class JWTGuard implements Guard
|
||||
* Log the given User into the application.
|
||||
*
|
||||
* @param mixed $id
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function onceUsingId($id)
|
||||
@@ -239,7 +229,6 @@ class JWTGuard implements Guard
|
||||
* Alias for onceUsingId.
|
||||
*
|
||||
* @param mixed $id
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function byId($id)
|
||||
@@ -251,7 +240,6 @@ class JWTGuard implements Guard
|
||||
* Add any custom claims.
|
||||
*
|
||||
* @param array $claims
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function claims(array $claims)
|
||||
@@ -285,7 +273,6 @@ class JWTGuard implements Guard
|
||||
* Set the token.
|
||||
*
|
||||
* @param \Tymon\JWTAuth\Token|string $token
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setToken($token)
|
||||
@@ -299,7 +286,6 @@ class JWTGuard implements Guard
|
||||
* Set the token ttl.
|
||||
*
|
||||
* @param int $ttl
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setTTL($ttl)
|
||||
@@ -323,7 +309,6 @@ class JWTGuard implements Guard
|
||||
* Set the user provider used by the guard.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Auth\UserProvider $provider
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setProvider(UserProvider $provider)
|
||||
@@ -357,7 +342,6 @@ class JWTGuard implements Guard
|
||||
* Set the current request instance.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setRequest(Request $request)
|
||||
@@ -382,7 +366,6 @@ class JWTGuard implements Guard
|
||||
*
|
||||
* @param mixed $user
|
||||
* @param array $credentials
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function hasValidCredentials($user, $credentials)
|
||||
@@ -393,7 +376,7 @@ class JWTGuard implements Guard
|
||||
/**
|
||||
* Ensure the JWTSubject matches what is in the token.
|
||||
*
|
||||
* @return bool
|
||||
* @return bool
|
||||
*/
|
||||
protected function validateSubject()
|
||||
{
|
||||
@@ -409,9 +392,9 @@ class JWTGuard implements Guard
|
||||
/**
|
||||
* Ensure that a token is available in the request.
|
||||
*
|
||||
* @throws \Tymon\JWTAuth\Exceptions\JWTException
|
||||
*
|
||||
* @return \Tymon\JWTAuth\JWT
|
||||
*
|
||||
* @throws \Tymon\JWTAuth\Exceptions\JWTException
|
||||
*/
|
||||
protected function requireToken()
|
||||
{
|
||||
@@ -427,10 +410,9 @@ class JWTGuard implements Guard
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $parameters
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \BadMethodCallException
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call($method, $parameters)
|
||||
{
|
||||
|
||||
12
vendor/tymon/jwt-auth/src/Manager.php
vendored
12
vendor/tymon/jwt-auth/src/Manager.php
vendored
@@ -62,7 +62,6 @@ class Manager
|
||||
* @param \Tymon\JWTAuth\Contracts\Providers\JWT $provider
|
||||
* @param \Tymon\JWTAuth\Blacklist $blacklist
|
||||
* @param \Tymon\JWTAuth\Factory $payloadFactory
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(JWTContract $provider, Blacklist $blacklist, Factory $payloadFactory)
|
||||
@@ -76,7 +75,6 @@ class Manager
|
||||
* Encode a Payload and return the Token.
|
||||
*
|
||||
* @param \Tymon\JWTAuth\Payload $payload
|
||||
*
|
||||
* @return \Tymon\JWTAuth\Token
|
||||
*/
|
||||
public function encode(Payload $payload)
|
||||
@@ -91,10 +89,9 @@ class Manager
|
||||
*
|
||||
* @param \Tymon\JWTAuth\Token $token
|
||||
* @param bool $checkBlacklist
|
||||
* @return \Tymon\JWTAuth\Payload
|
||||
*
|
||||
* @throws \Tymon\JWTAuth\Exceptions\TokenBlacklistedException
|
||||
*
|
||||
* @return \Tymon\JWTAuth\Payload
|
||||
*/
|
||||
public function decode(Token $token, $checkBlacklist = true)
|
||||
{
|
||||
@@ -118,7 +115,6 @@ class Manager
|
||||
* @param \Tymon\JWTAuth\Token $token
|
||||
* @param bool $forceForever
|
||||
* @param bool $resetClaims
|
||||
*
|
||||
* @return \Tymon\JWTAuth\Token
|
||||
*/
|
||||
public function refresh(Token $token, $forceForever = false, $resetClaims = false)
|
||||
@@ -143,10 +139,9 @@ class Manager
|
||||
*
|
||||
* @param \Tymon\JWTAuth\Token $token
|
||||
* @param bool $forceForever
|
||||
* @return bool
|
||||
*
|
||||
* @throws \Tymon\JWTAuth\Exceptions\JWTException
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function invalidate(Token $token, $forceForever = false)
|
||||
{
|
||||
@@ -164,7 +159,6 @@ class Manager
|
||||
* Build the claims to go into the refreshed token.
|
||||
*
|
||||
* @param \Tymon\JWTAuth\Payload $payload
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function buildRefreshClaims(Payload $payload)
|
||||
@@ -219,7 +213,6 @@ class Manager
|
||||
* Set whether the blacklist is enabled.
|
||||
*
|
||||
* @param bool $enabled
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setBlacklistEnabled($enabled)
|
||||
@@ -233,7 +226,6 @@ class Manager
|
||||
* Set the claims to be persisted when refreshing a token.
|
||||
*
|
||||
* @param array $claims
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPersistentClaims(array $claims)
|
||||
|
||||
26
vendor/tymon/jwt-auth/src/Payload.php
vendored
26
vendor/tymon/jwt-auth/src/Payload.php
vendored
@@ -17,6 +17,7 @@ use Countable;
|
||||
use Illuminate\Contracts\Support\Arrayable;
|
||||
use Illuminate\Contracts\Support\Jsonable;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Str;
|
||||
use JsonSerializable;
|
||||
use Tymon\JWTAuth\Claims\Claim;
|
||||
use Tymon\JWTAuth\Claims\Collection;
|
||||
@@ -38,7 +39,6 @@ class Payload implements ArrayAccess, Arrayable, Countable, Jsonable, JsonSerial
|
||||
* @param \Tymon\JWTAuth\Claims\Collection $claims
|
||||
* @param \Tymon\JWTAuth\Validators\PayloadValidator $validator
|
||||
* @param bool $refreshFlow
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Collection $claims, PayloadValidator $validator, $refreshFlow = false)
|
||||
@@ -61,7 +61,6 @@ class Payload implements ArrayAccess, Arrayable, Countable, Jsonable, JsonSerial
|
||||
*
|
||||
* @param array $values
|
||||
* @param bool $strict
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function matches(array $values, $strict = false)
|
||||
@@ -85,7 +84,6 @@ class Payload implements ArrayAccess, Arrayable, Countable, Jsonable, JsonSerial
|
||||
* Checks if a payload strictly matches some expected values.
|
||||
*
|
||||
* @param array $values
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function matchesStrict(array $values)
|
||||
@@ -97,7 +95,6 @@ class Payload implements ArrayAccess, Arrayable, Countable, Jsonable, JsonSerial
|
||||
* Get the payload.
|
||||
*
|
||||
* @param mixed $claim
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function get($claim = null)
|
||||
@@ -119,7 +116,6 @@ class Payload implements ArrayAccess, Arrayable, Countable, Jsonable, JsonSerial
|
||||
* Get the underlying Claim instance.
|
||||
*
|
||||
* @param string $claim
|
||||
*
|
||||
* @return \Tymon\JWTAuth\Claims\Claim
|
||||
*/
|
||||
public function getInternal($claim)
|
||||
@@ -131,7 +127,6 @@ class Payload implements ArrayAccess, Arrayable, Countable, Jsonable, JsonSerial
|
||||
* Determine whether the payload has the claim (by instance).
|
||||
*
|
||||
* @param \Tymon\JWTAuth\Claims\Claim $claim
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function has(Claim $claim)
|
||||
@@ -143,7 +138,6 @@ class Payload implements ArrayAccess, Arrayable, Countable, Jsonable, JsonSerial
|
||||
* Determine whether the payload has the claim (by key).
|
||||
*
|
||||
* @param string $claim
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasKey($claim)
|
||||
@@ -166,6 +160,7 @@ class Payload implements ArrayAccess, Arrayable, Countable, Jsonable, JsonSerial
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return $this->toArray();
|
||||
@@ -175,7 +170,6 @@ class Payload implements ArrayAccess, Arrayable, Countable, Jsonable, JsonSerial
|
||||
* Get the payload as JSON.
|
||||
*
|
||||
* @param int $options
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toJson($options = JSON_UNESCAPED_SLASHES)
|
||||
@@ -197,9 +191,9 @@ class Payload implements ArrayAccess, Arrayable, Countable, Jsonable, JsonSerial
|
||||
* Determine if an item exists at an offset.
|
||||
*
|
||||
* @param mixed $key
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetExists($key)
|
||||
{
|
||||
return Arr::has($this->toArray(), $key);
|
||||
@@ -209,9 +203,9 @@ class Payload implements ArrayAccess, Arrayable, Countable, Jsonable, JsonSerial
|
||||
* Get an item at a given offset.
|
||||
*
|
||||
* @param mixed $key
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($key)
|
||||
{
|
||||
return Arr::get($this->toArray(), $key);
|
||||
@@ -225,6 +219,7 @@ class Payload implements ArrayAccess, Arrayable, Countable, Jsonable, JsonSerial
|
||||
*
|
||||
* @throws \Tymon\JWTAuth\Exceptions\PayloadException
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetSet($key, $value)
|
||||
{
|
||||
throw new PayloadException('The payload is immutable');
|
||||
@@ -234,11 +229,11 @@ class Payload implements ArrayAccess, Arrayable, Countable, Jsonable, JsonSerial
|
||||
* Don't allow changing the payload as it should be immutable.
|
||||
*
|
||||
* @param string $key
|
||||
* @return void
|
||||
*
|
||||
* @throws \Tymon\JWTAuth\Exceptions\PayloadException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetUnset($key)
|
||||
{
|
||||
throw new PayloadException('The payload is immutable');
|
||||
@@ -249,6 +244,7 @@ class Payload implements ArrayAccess, Arrayable, Countable, Jsonable, JsonSerial
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function count()
|
||||
{
|
||||
return count($this->toArray());
|
||||
@@ -258,7 +254,6 @@ class Payload implements ArrayAccess, Arrayable, Countable, Jsonable, JsonSerial
|
||||
* Invoke the Payload as a callable function.
|
||||
*
|
||||
* @param mixed $claim
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function __invoke($claim = null)
|
||||
@@ -271,10 +266,9 @@ class Payload implements ArrayAccess, Arrayable, Countable, Jsonable, JsonSerial
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $parameters
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \BadMethodCallException
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call($method, $parameters)
|
||||
{
|
||||
@@ -286,6 +280,6 @@ class Payload implements ArrayAccess, Arrayable, Countable, Jsonable, JsonSerial
|
||||
}
|
||||
}
|
||||
|
||||
throw new BadMethodCallException(sprintf('The claim [%s] does not exist on the payload.', $method));
|
||||
throw new BadMethodCallException(sprintf('The claim [%s] does not exist on the payload.', Str::after($method, 'get')));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
namespace Tymon\JWTAuth\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Lcobucci\JWT\Builder as JWTBuilder;
|
||||
use Lcobucci\JWT\Parser as JWTParser;
|
||||
use Namshi\JOSE\JWS;
|
||||
use Tymon\JWTAuth\Blacklist;
|
||||
use Tymon\JWTAuth\Claims\Factory as ClaimFactory;
|
||||
@@ -27,11 +25,9 @@ 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;
|
||||
@@ -169,8 +165,6 @@ abstract class AbstractServiceProvider extends ServiceProvider
|
||||
{
|
||||
$this->app->singleton('tymon.jwt.provider.jwt.lcobucci', function ($app) {
|
||||
return new Lcobucci(
|
||||
new JWTBuilder(),
|
||||
new JWTParser(),
|
||||
$this->config('secret'),
|
||||
$this->config('algo'),
|
||||
$this->config('keys')
|
||||
@@ -235,8 +229,6 @@ abstract class AbstractServiceProvider extends ServiceProvider
|
||||
new AuthHeaders,
|
||||
new QueryString,
|
||||
new InputSource,
|
||||
new RouteParams,
|
||||
new Cookies($this->config('decrypt_cookies')),
|
||||
]
|
||||
);
|
||||
|
||||
@@ -354,7 +346,6 @@ abstract class AbstractServiceProvider extends ServiceProvider
|
||||
*
|
||||
* @param string $key
|
||||
* @param string $default
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected function config($key, $default = null)
|
||||
@@ -366,7 +357,6 @@ abstract class AbstractServiceProvider extends ServiceProvider
|
||||
* Get an instantiable configuration instance.
|
||||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getConfigInstance($key)
|
||||
|
||||
@@ -27,7 +27,6 @@ class Illuminate implements Auth
|
||||
* Constructor.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Auth\Guard $auth
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(GuardContract $auth)
|
||||
@@ -39,7 +38,6 @@ class Illuminate implements Auth
|
||||
* Check a user's credentials.
|
||||
*
|
||||
* @param array $credentials
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function byCredentials(array $credentials)
|
||||
@@ -51,7 +49,6 @@ class Illuminate implements Auth
|
||||
* Authenticate a user via the id.
|
||||
*
|
||||
* @param mixed $id
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function byId($id)
|
||||
|
||||
233
vendor/tymon/jwt-auth/src/Providers/JWT/Lcobucci.php
vendored
233
vendor/tymon/jwt-auth/src/Providers/JWT/Lcobucci.php
vendored
@@ -11,23 +11,19 @@
|
||||
|
||||
namespace Tymon\JWTAuth\Providers\JWT;
|
||||
|
||||
use DateTimeImmutable;
|
||||
use DateTimeInterface;
|
||||
use Exception;
|
||||
use Illuminate\Support\Collection;
|
||||
use Lcobucci\JWT\Builder;
|
||||
use Lcobucci\JWT\Parser;
|
||||
use Lcobucci\JWT\Configuration;
|
||||
use Lcobucci\JWT\Signer;
|
||||
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\Key;
|
||||
use Lcobucci\JWT\Signer\Key\InMemory;
|
||||
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 Lcobucci\JWT\Token\Builder;
|
||||
use Lcobucci\JWT\Token\RegisteredClaims;
|
||||
use Lcobucci\JWT\Validation\Constraint\SignedWith;
|
||||
use Tymon\JWTAuth\Contracts\Providers\JWT;
|
||||
use Tymon\JWTAuth\Exceptions\JWTException;
|
||||
use Tymon\JWTAuth\Exceptions\TokenInvalidException;
|
||||
@@ -35,42 +31,30 @@ use Tymon\JWTAuth\Exceptions\TokenInvalidException;
|
||||
class Lcobucci extends Provider implements JWT
|
||||
{
|
||||
/**
|
||||
* The Builder instance.
|
||||
*
|
||||
* @var \Lcobucci\JWT\Builder
|
||||
* \Lcobucci\JWT\Signer.
|
||||
*/
|
||||
protected $builder;
|
||||
protected $signer;
|
||||
|
||||
/**
|
||||
* The Parser instance.
|
||||
*
|
||||
* @var \Lcobucci\JWT\Parser
|
||||
* \Lcobucci\JWT\Configuration.
|
||||
*/
|
||||
protected $parser;
|
||||
protected $config;
|
||||
|
||||
/**
|
||||
* Create the Lcobucci provider.
|
||||
*
|
||||
* @param \Lcobucci\JWT\Builder $builder
|
||||
* @param \Lcobucci\JWT\Parser $parser
|
||||
* @param string $secret
|
||||
* @param string $algo
|
||||
* @param array $keys
|
||||
*
|
||||
* @param \Lcobucci\JWT\Configuration|null $config
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
Builder $builder,
|
||||
Parser $parser,
|
||||
$secret,
|
||||
$algo,
|
||||
array $keys
|
||||
) {
|
||||
public function __construct($secret, $algo, array $keys, $config = null)
|
||||
{
|
||||
parent::__construct($secret, $algo, $keys);
|
||||
|
||||
$this->builder = $builder;
|
||||
$this->parser = $parser;
|
||||
$this->signer = $this->getSigner();
|
||||
$this->config = $config ?: $this->buildConfig();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -79,75 +63,141 @@ class Lcobucci extends Provider implements JWT
|
||||
* @var array
|
||||
*/
|
||||
protected $signers = [
|
||||
'HS256' => HS256::class,
|
||||
'HS384' => HS384::class,
|
||||
'HS512' => HS512::class,
|
||||
'RS256' => RS256::class,
|
||||
'RS384' => RS384::class,
|
||||
'RS512' => RS512::class,
|
||||
'ES256' => ES256::class,
|
||||
'ES384' => ES384::class,
|
||||
'ES512' => ES512::class,
|
||||
self::ALGO_HS256 => Signer\Hmac\Sha256::class,
|
||||
self::ALGO_HS384 => Signer\Hmac\Sha384::class,
|
||||
self::ALGO_HS512 => Signer\Hmac\Sha512::class,
|
||||
self::ALGO_RS256 => Signer\Rsa\Sha256::class,
|
||||
self::ALGO_RS384 => Signer\Rsa\Sha384::class,
|
||||
self::ALGO_RS512 => Signer\Rsa\Sha512::class,
|
||||
self::ALGO_ES256 => Signer\Ecdsa\Sha256::class,
|
||||
self::ALGO_ES384 => Signer\Ecdsa\Sha384::class,
|
||||
self::ALGO_ES512 => Signer\Ecdsa\Sha512::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* Create a JSON Web Token.
|
||||
*
|
||||
* @param array $payload
|
||||
* @return string
|
||||
*
|
||||
* @throws \Tymon\JWTAuth\Exceptions\JWTException
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function encode(array $payload)
|
||||
{
|
||||
// Remove the signature on the builder instance first.
|
||||
$this->builder->unsign();
|
||||
$builder = $this->getBuilderFromClaims($payload);
|
||||
|
||||
try {
|
||||
foreach ($payload as $key => $value) {
|
||||
$this->builder->set($key, $value);
|
||||
}
|
||||
$this->builder->sign($this->signer, $this->getSigningKey());
|
||||
return $builder
|
||||
->getToken($this->config->signer(), $this->config->signingKey())
|
||||
->toString();
|
||||
} catch (Exception $e) {
|
||||
throw new JWTException('Could not create token: '.$e->getMessage(), $e->getCode(), $e);
|
||||
}
|
||||
|
||||
return (string) $this->builder->getToken();
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode a JSON Web Token.
|
||||
*
|
||||
* @param string $token
|
||||
* @return array
|
||||
*
|
||||
* @throws \Tymon\JWTAuth\Exceptions\JWTException
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function decode($token)
|
||||
{
|
||||
try {
|
||||
$jwt = $this->parser->parse($token);
|
||||
/** @var \Lcobucci\JWT\Token\Plain */
|
||||
$token = $this->config->parser()->parse($token);
|
||||
} catch (Exception $e) {
|
||||
throw new TokenInvalidException('Could not decode token: '.$e->getMessage(), $e->getCode(), $e);
|
||||
}
|
||||
|
||||
if (! $jwt->verify($this->signer, $this->getVerificationKey())) {
|
||||
if (! $this->config->validator()->validate($token, ...$this->config->validationConstraints())) {
|
||||
throw new TokenInvalidException('Token Signature could not be verified.');
|
||||
}
|
||||
|
||||
return (new Collection($jwt->getClaims()))->map(function ($claim) {
|
||||
return is_object($claim) ? $claim->getValue() : $claim;
|
||||
})->toArray();
|
||||
return Collection::wrap($token->claims()->all())
|
||||
->map(function ($claim) {
|
||||
if ($claim instanceof DateTimeInterface) {
|
||||
return $claim->getTimestamp();
|
||||
}
|
||||
|
||||
return is_object($claim) && method_exists($claim, 'getValue')
|
||||
? $claim->getValue()
|
||||
: $claim;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of the builder with all of the claims applied.
|
||||
*
|
||||
* @param array $payload
|
||||
* @return \Lcobucci\JWT\Token\Builder
|
||||
*/
|
||||
protected function getBuilderFromClaims(array $payload): Builder
|
||||
{
|
||||
$builder = $this->config->builder();
|
||||
|
||||
foreach ($payload as $key => $value) {
|
||||
switch ($key) {
|
||||
case RegisteredClaims::ID:
|
||||
$builder->identifiedBy($value);
|
||||
break;
|
||||
case RegisteredClaims::EXPIRATION_TIME:
|
||||
$builder->expiresAt(DateTimeImmutable::createFromFormat('U', $value));
|
||||
break;
|
||||
case RegisteredClaims::NOT_BEFORE:
|
||||
$builder->canOnlyBeUsedAfter(DateTimeImmutable::createFromFormat('U', $value));
|
||||
break;
|
||||
case RegisteredClaims::ISSUED_AT:
|
||||
$builder->issuedAt(DateTimeImmutable::createFromFormat('U', $value));
|
||||
break;
|
||||
case RegisteredClaims::ISSUER:
|
||||
$builder->issuedBy($value);
|
||||
break;
|
||||
case RegisteredClaims::AUDIENCE:
|
||||
$builder->permittedFor($value);
|
||||
break;
|
||||
case RegisteredClaims::SUBJECT:
|
||||
$builder->relatedTo($value);
|
||||
break;
|
||||
default:
|
||||
$builder->withClaim($key, $value);
|
||||
}
|
||||
}
|
||||
|
||||
return $builder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the configuration.
|
||||
*
|
||||
* @return \Lcobucci\JWT\Configuration
|
||||
*/
|
||||
protected function buildConfig(): Configuration
|
||||
{
|
||||
$config = $this->isAsymmetric()
|
||||
? Configuration::forAsymmetricSigner(
|
||||
$this->signer,
|
||||
$this->getSigningKey(),
|
||||
$this->getVerificationKey()
|
||||
)
|
||||
: Configuration::forSymmetricSigner($this->signer, $this->getSigningKey());
|
||||
|
||||
$config->setValidationConstraints(
|
||||
new SignedWith($this->signer, $this->getVerificationKey())
|
||||
);
|
||||
|
||||
return $config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the signer instance.
|
||||
*
|
||||
* @throws \Tymon\JWTAuth\Exceptions\JWTException
|
||||
*
|
||||
* @return \Lcobucci\JWT\Signer
|
||||
*
|
||||
* @throws \Tymon\JWTAuth\Exceptions\JWTException
|
||||
*/
|
||||
protected function getSigner()
|
||||
{
|
||||
@@ -155,7 +205,13 @@ class Lcobucci extends Provider implements JWT
|
||||
throw new JWTException('The given algorithm could not be found');
|
||||
}
|
||||
|
||||
return new $this->signers[$this->algo];
|
||||
$signer = $this->signers[$this->algo];
|
||||
|
||||
if (is_subclass_of($signer, Ecdsa::class)) {
|
||||
return $signer::create();
|
||||
}
|
||||
|
||||
return new $signer();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -163,28 +219,63 @@ class Lcobucci extends Provider implements JWT
|
||||
*/
|
||||
protected function isAsymmetric()
|
||||
{
|
||||
$reflect = new ReflectionClass($this->signer);
|
||||
|
||||
return $reflect->isSubclassOf(Rsa::class) || $reflect->isSubclassOf(Ecdsa::class);
|
||||
return is_subclass_of($this->signer, Rsa::class)
|
||||
|| is_subclass_of($this->signer, Ecdsa::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return \Lcobucci\JWT\Signer\Key
|
||||
*
|
||||
* @throws \Tymon\JWTAuth\Exceptions\JWTException
|
||||
*/
|
||||
protected function getSigningKey()
|
||||
{
|
||||
return $this->isAsymmetric() ?
|
||||
(new Keychain())->getPrivateKey($this->getPrivateKey(), $this->getPassphrase()) :
|
||||
$this->getSecret();
|
||||
if ($this->isAsymmetric()) {
|
||||
if (! $privateKey = $this->getPrivateKey()) {
|
||||
throw new JWTException('Private key is not set.');
|
||||
}
|
||||
|
||||
return $this->getKey($privateKey, $this->getPassphrase() ?? '');
|
||||
}
|
||||
|
||||
if (! $secret = $this->getSecret()) {
|
||||
throw new JWTException('Secret is not set.');
|
||||
}
|
||||
|
||||
return $this->getKey($secret);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return \Lcobucci\JWT\Signer\Key
|
||||
*
|
||||
* @throws \Tymon\JWTAuth\Exceptions\JWTException
|
||||
*/
|
||||
protected function getVerificationKey()
|
||||
{
|
||||
return $this->isAsymmetric() ?
|
||||
(new Keychain())->getPublicKey($this->getPublicKey()) :
|
||||
$this->getSecret();
|
||||
if ($this->isAsymmetric()) {
|
||||
if (! $public = $this->getPublicKey()) {
|
||||
throw new JWTException('Public key is not set.');
|
||||
}
|
||||
|
||||
return $this->getKey($public);
|
||||
}
|
||||
|
||||
if (! $secret = $this->getSecret()) {
|
||||
throw new JWTException('Secret is not set.');
|
||||
}
|
||||
|
||||
return $this->getKey($secret);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the signing key instance.
|
||||
*/
|
||||
protected function getKey(string $contents, string $passphrase = ''): Key
|
||||
{
|
||||
return InMemory::plainText($contents, $passphrase);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,6 @@ class Namshi extends Provider implements JWT
|
||||
* @param string $secret
|
||||
* @param string $algo
|
||||
* @param array $keys
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(JWS $jws, $secret, $algo, array $keys)
|
||||
@@ -51,10 +50,9 @@ class Namshi extends Provider implements JWT
|
||||
* Create a JSON Web Token.
|
||||
*
|
||||
* @param array $payload
|
||||
* @return string
|
||||
*
|
||||
* @throws \Tymon\JWTAuth\Exceptions\JWTException
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function encode(array $payload)
|
||||
{
|
||||
@@ -71,10 +69,9 @@ class Namshi extends Provider implements JWT
|
||||
* Decode a JSON Web Token.
|
||||
*
|
||||
* @param string $token
|
||||
* @return array
|
||||
*
|
||||
* @throws \Tymon\JWTAuth\Exceptions\JWTException
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function decode($token)
|
||||
{
|
||||
|
||||
@@ -15,6 +15,16 @@ use Illuminate\Support\Arr;
|
||||
|
||||
abstract class Provider
|
||||
{
|
||||
const ALGO_HS256 = 'HS256';
|
||||
const ALGO_HS384 = 'HS384';
|
||||
const ALGO_HS512 = 'HS512';
|
||||
const ALGO_RS256 = 'RS256';
|
||||
const ALGO_RS384 = 'RS384';
|
||||
const ALGO_RS512 = 'RS512';
|
||||
const ALGO_ES256 = 'ES256';
|
||||
const ALGO_ES384 = 'ES384';
|
||||
const ALGO_ES512 = 'ES512';
|
||||
|
||||
/**
|
||||
* The secret.
|
||||
*
|
||||
@@ -42,7 +52,6 @@ abstract class Provider
|
||||
* @param string $secret
|
||||
* @param string $algo
|
||||
* @param array $keys
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($secret, $algo, array $keys)
|
||||
@@ -56,7 +65,6 @@ abstract class Provider
|
||||
* Set the algorithm used to sign the token.
|
||||
*
|
||||
* @param string $algo
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAlgo($algo)
|
||||
@@ -80,7 +88,6 @@ abstract class Provider
|
||||
* Set the secret used to sign the token.
|
||||
*
|
||||
* @param string $secret
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setSecret($secret)
|
||||
@@ -104,7 +111,6 @@ abstract class Provider
|
||||
* Set the keys used to sign the token.
|
||||
*
|
||||
* @param array $keys
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setKeys(array $keys)
|
||||
@@ -115,8 +121,7 @@ abstract class Provider
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the array of keys used to sign tokens
|
||||
* with an asymmetric algorithm.
|
||||
* Get the array of keys used to sign tokens with an asymmetric algorithm.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@@ -126,10 +131,9 @@ abstract class Provider
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the public key used to sign tokens
|
||||
* with an asymmetric algorithm.
|
||||
* Get the public key used to sign tokens with an asymmetric algorithm.
|
||||
*
|
||||
* @return resource|string
|
||||
* @return string|null
|
||||
*/
|
||||
public function getPublicKey()
|
||||
{
|
||||
@@ -137,10 +141,9 @@ abstract class Provider
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the private key used to sign tokens
|
||||
* with an asymmetric algorithm.
|
||||
* Get the private key used to sign tokens with an asymmetric algorithm.
|
||||
*
|
||||
* @return resource|string
|
||||
* @return string|null
|
||||
*/
|
||||
public function getPrivateKey()
|
||||
{
|
||||
@@ -151,7 +154,7 @@ abstract class Provider
|
||||
* Get the passphrase used to sign tokens
|
||||
* with an asymmetric algorithm.
|
||||
*
|
||||
* @return string
|
||||
* @return string|null
|
||||
*/
|
||||
public function getPassphrase()
|
||||
{
|
||||
@@ -161,7 +164,7 @@ abstract class Provider
|
||||
/**
|
||||
* Get the key used to sign the tokens.
|
||||
*
|
||||
* @return resource|string
|
||||
* @return string|null
|
||||
*/
|
||||
protected function getSigningKey()
|
||||
{
|
||||
@@ -171,7 +174,7 @@ abstract class Provider
|
||||
/**
|
||||
* Get the key used to verify the tokens.
|
||||
*
|
||||
* @return resource|string
|
||||
* @return string|null
|
||||
*/
|
||||
protected function getVerificationKey()
|
||||
{
|
||||
@@ -179,10 +182,7 @@ abstract class Provider
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the algorithm is asymmetric, and thus
|
||||
* requires a public/private key combo.
|
||||
*
|
||||
* @throws \Tymon\JWTAuth\Exceptions\JWTException
|
||||
* Determine if the algorithm is asymmetric, and thus requires a public/private key combo.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
|
||||
namespace Tymon\JWTAuth\Providers;
|
||||
|
||||
use Tymon\JWTAuth\Http\Parser\Cookies;
|
||||
use Tymon\JWTAuth\Http\Parser\RouteParams;
|
||||
|
||||
class LaravelServiceProvider extends AbstractServiceProvider
|
||||
{
|
||||
/**
|
||||
@@ -26,6 +29,11 @@ class LaravelServiceProvider extends AbstractServiceProvider
|
||||
$this->aliasMiddleware();
|
||||
|
||||
$this->extendAuthGuard();
|
||||
|
||||
$this->app['tymon.jwt.parser']->addParser([
|
||||
new RouteParams,
|
||||
new Cookies($this->config('decrypt_cookies')),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,10 +11,7 @@
|
||||
|
||||
namespace Tymon\JWTAuth\Providers;
|
||||
|
||||
use Tymon\JWTAuth\Http\Parser\AuthHeaders;
|
||||
use Tymon\JWTAuth\Http\Parser\InputSource;
|
||||
use Tymon\JWTAuth\Http\Parser\LumenRouteParams;
|
||||
use Tymon\JWTAuth\Http\Parser\QueryString;
|
||||
|
||||
class LumenServiceProvider extends AbstractServiceProvider
|
||||
{
|
||||
@@ -32,11 +29,6 @@ class LumenServiceProvider extends AbstractServiceProvider
|
||||
|
||||
$this->extendAuthGuard();
|
||||
|
||||
$this->app['tymon.jwt.parser']->setChain([
|
||||
new AuthHeaders,
|
||||
new QueryString,
|
||||
new InputSource,
|
||||
new LumenRouteParams,
|
||||
]);
|
||||
$this->app['tymon.jwt.parser']->addParser(new LumenRouteParams);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,6 @@ class Illuminate implements Storage
|
||||
* Constructor.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Cache\Repository $cache
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(CacheContract $cache)
|
||||
@@ -60,7 +59,6 @@ class Illuminate implements Storage
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @param int $minutes
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function add($key, $value, $minutes)
|
||||
@@ -81,7 +79,6 @@ class Illuminate implements Storage
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function forever($key, $value)
|
||||
@@ -93,7 +90,6 @@ class Illuminate implements Storage
|
||||
* Get an item from storage.
|
||||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function get($key)
|
||||
@@ -105,7 +101,6 @@ class Illuminate implements Storage
|
||||
* Remove an item from storage.
|
||||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function destroy($key)
|
||||
|
||||
@@ -24,7 +24,6 @@ trait CustomClaims
|
||||
* Set the custom claims.
|
||||
*
|
||||
* @param array $customClaims
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function customClaims(array $customClaims)
|
||||
@@ -38,7 +37,6 @@ trait CustomClaims
|
||||
* Alias to set the custom claims.
|
||||
*
|
||||
* @param array $customClaims
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function claims(array $customClaims)
|
||||
|
||||
@@ -24,7 +24,6 @@ trait RefreshFlow
|
||||
* Set the refresh flow flag.
|
||||
*
|
||||
* @param bool $refreshFlow
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setRefreshFlow($refreshFlow = true)
|
||||
|
||||
3
vendor/tymon/jwt-auth/src/Support/Utils.php
vendored
3
vendor/tymon/jwt-auth/src/Support/Utils.php
vendored
@@ -29,7 +29,6 @@ class Utils
|
||||
* Get the Carbon instance for the timestamp.
|
||||
*
|
||||
* @param int $timestamp
|
||||
*
|
||||
* @return \Carbon\Carbon
|
||||
*/
|
||||
public static function timestamp($timestamp)
|
||||
@@ -42,7 +41,6 @@ class Utils
|
||||
*
|
||||
* @param int $timestamp
|
||||
* @param int $leeway
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isPast($timestamp, $leeway = 0)
|
||||
@@ -59,7 +57,6 @@ class Utils
|
||||
*
|
||||
* @param int $timestamp
|
||||
* @param int $leeway
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isFuture($timestamp, $leeway = 0)
|
||||
|
||||
1
vendor/tymon/jwt-auth/src/Token.php
vendored
1
vendor/tymon/jwt-auth/src/Token.php
vendored
@@ -24,7 +24,6 @@ class Token
|
||||
* Create a new JSON Web Token.
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($value)
|
||||
|
||||
@@ -41,7 +41,6 @@ class PayloadValidator extends Validator
|
||||
* Run the validations on the payload array.
|
||||
*
|
||||
* @param \Tymon\JWTAuth\Claims\Collection $value
|
||||
*
|
||||
* @return \Tymon\JWTAuth\Claims\Collection
|
||||
*/
|
||||
public function check($value)
|
||||
@@ -56,10 +55,9 @@ class PayloadValidator extends Validator
|
||||
* the claims have the relevant type.
|
||||
*
|
||||
* @param \Tymon\JWTAuth\Claims\Collection $claims
|
||||
* @return void
|
||||
*
|
||||
* @throws \Tymon\JWTAuth\Exceptions\TokenInvalidException
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function validateStructure(Collection $claims)
|
||||
{
|
||||
@@ -72,11 +70,10 @@ class PayloadValidator extends Validator
|
||||
* Validate the payload timestamps.
|
||||
*
|
||||
* @param \Tymon\JWTAuth\Claims\Collection $claims
|
||||
* @return \Tymon\JWTAuth\Claims\Collection
|
||||
*
|
||||
* @throws \Tymon\JWTAuth\Exceptions\TokenExpiredException
|
||||
* @throws \Tymon\JWTAuth\Exceptions\TokenInvalidException
|
||||
*
|
||||
* @return \Tymon\JWTAuth\Claims\Collection
|
||||
*/
|
||||
protected function validatePayload(Collection $claims)
|
||||
{
|
||||
@@ -87,10 +84,9 @@ class PayloadValidator extends Validator
|
||||
* Check the token in the refresh flow context.
|
||||
*
|
||||
* @param \Tymon\JWTAuth\Claims\Collection $claims
|
||||
* @return \Tymon\JWTAuth\Claims\Collection
|
||||
*
|
||||
* @throws \Tymon\JWTAuth\Exceptions\TokenExpiredException
|
||||
*
|
||||
* @return \Tymon\JWTAuth\Claims\Collection
|
||||
*/
|
||||
protected function validateRefresh(Collection $claims)
|
||||
{
|
||||
@@ -101,7 +97,6 @@ class PayloadValidator extends Validator
|
||||
* Set the required claims.
|
||||
*
|
||||
* @param array $claims
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setRequiredClaims(array $claims)
|
||||
@@ -115,7 +110,6 @@ class PayloadValidator extends Validator
|
||||
* Set the refresh ttl.
|
||||
*
|
||||
* @param int $ttl
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setRefreshTTL($ttl)
|
||||
|
||||
@@ -19,7 +19,6 @@ class TokenValidator extends Validator
|
||||
* Check the structure of the token.
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function check($value)
|
||||
@@ -29,10 +28,9 @@ class TokenValidator extends Validator
|
||||
|
||||
/**
|
||||
* @param string $token
|
||||
* @return string
|
||||
*
|
||||
* @throws \Tymon\JWTAuth\Exceptions\TokenInvalidException
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function validateStructure($token)
|
||||
{
|
||||
|
||||
@@ -23,7 +23,6 @@ abstract class Validator implements ValidatorContract
|
||||
* Helper function to return a boolean.
|
||||
*
|
||||
* @param array $value
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isValid($value)
|
||||
@@ -41,7 +40,6 @@ abstract class Validator implements ValidatorContract
|
||||
* Run the validation.
|
||||
*
|
||||
* @param array $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
abstract public function check($value);
|
||||
|
||||
Reference in New Issue
Block a user