Laravel version update
Laravel version update
This commit is contained in:
58
vendor/tymon/jwt-auth/src/Support/CustomClaims.php
vendored
Normal file
58
vendor/tymon/jwt-auth/src/Support/CustomClaims.php
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
<?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\Support;
|
||||
|
||||
trait CustomClaims
|
||||
{
|
||||
/**
|
||||
* Custom claims.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $customClaims = [];
|
||||
|
||||
/**
|
||||
* Set the custom claims.
|
||||
*
|
||||
* @param array $customClaims
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function customClaims(array $customClaims)
|
||||
{
|
||||
$this->customClaims = $customClaims;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias to set the custom claims.
|
||||
*
|
||||
* @param array $customClaims
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function claims(array $customClaims)
|
||||
{
|
||||
return $this->customClaims($customClaims);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the custom claims.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getCustomClaims()
|
||||
{
|
||||
return $this->customClaims;
|
||||
}
|
||||
}
|
||||
36
vendor/tymon/jwt-auth/src/Support/RefreshFlow.php
vendored
Normal file
36
vendor/tymon/jwt-auth/src/Support/RefreshFlow.php
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
<?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\Support;
|
||||
|
||||
trait RefreshFlow
|
||||
{
|
||||
/**
|
||||
* The refresh flow flag.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $refreshFlow = false;
|
||||
|
||||
/**
|
||||
* Set the refresh flow flag.
|
||||
*
|
||||
* @param bool $refreshFlow
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setRefreshFlow($refreshFlow = true)
|
||||
{
|
||||
$this->refreshFlow = $refreshFlow;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
73
vendor/tymon/jwt-auth/src/Support/Utils.php
vendored
Normal file
73
vendor/tymon/jwt-auth/src/Support/Utils.php
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
<?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\Support;
|
||||
|
||||
use Carbon\Carbon;
|
||||
|
||||
class Utils
|
||||
{
|
||||
/**
|
||||
* Get the Carbon instance for the current time.
|
||||
*
|
||||
* @return \Carbon\Carbon
|
||||
*/
|
||||
public static function now()
|
||||
{
|
||||
return Carbon::now('UTC');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Carbon instance for the timestamp.
|
||||
*
|
||||
* @param int $timestamp
|
||||
*
|
||||
* @return \Carbon\Carbon
|
||||
*/
|
||||
public static function timestamp($timestamp)
|
||||
{
|
||||
return Carbon::createFromTimestampUTC($timestamp)->timezone('UTC');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a timestamp is in the past.
|
||||
*
|
||||
* @param int $timestamp
|
||||
* @param int $leeway
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isPast($timestamp, $leeway = 0)
|
||||
{
|
||||
$timestamp = static::timestamp($timestamp);
|
||||
|
||||
return $leeway > 0
|
||||
? $timestamp->addSeconds($leeway)->isPast()
|
||||
: $timestamp->isPast();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a timestamp is in the future.
|
||||
*
|
||||
* @param int $timestamp
|
||||
* @param int $leeway
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isFuture($timestamp, $leeway = 0)
|
||||
{
|
||||
$timestamp = static::timestamp($timestamp);
|
||||
|
||||
return $leeway > 0
|
||||
? $timestamp->subSeconds($leeway)->isFuture()
|
||||
: $timestamp->isFuture();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user