mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 12:33:56 +00:00
Update: laravel 8 to 12, php 7.3 to php 8.3, Jenkinsfile, Unit/Feature testing, vapor, docker
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Fideloper\Proxy\TrustProxies as Middleware;
|
||||
use Illuminate\Http\Middleware\TrustProxies as Middleware;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class TrustProxies extends Middleware
|
||||
@@ -19,5 +19,10 @@ class TrustProxies extends Middleware
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $headers = Request::HEADER_X_FORWARDED_ALL;
|
||||
protected $headers =
|
||||
Request::HEADER_X_FORWARDED_FOR |
|
||||
Request::HEADER_X_FORWARDED_HOST |
|
||||
Request::HEADER_X_FORWARDED_PORT |
|
||||
Request::HEADER_X_FORWARDED_PROTO |
|
||||
Request::HEADER_X_FORWARDED_PREFIX;
|
||||
}
|
||||
|
||||
@@ -7,23 +7,9 @@ use App\Classes\ValueObjects\Constants\HttpStatus;
|
||||
use App\Classes\ValueObjects\Response\ApiResponseObject;
|
||||
use Closure;
|
||||
use Exception;
|
||||
use Tymon\JWTAuth\JWT;
|
||||
|
||||
class ValidateToken
|
||||
{
|
||||
/** @var JWT */
|
||||
private $manager;
|
||||
|
||||
/**
|
||||
* ValidateToken constructor.
|
||||
* @param JWT $manager
|
||||
*/
|
||||
public function __construct(JWT $manager)
|
||||
{
|
||||
$this->manager = $manager;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if jwt token is valid.
|
||||
*
|
||||
@@ -35,9 +21,9 @@ class ValidateToken
|
||||
{
|
||||
try {
|
||||
|
||||
if(!$this->manager->check()){ throw new AccessUnauthorisedException(); }
|
||||
if(!auth('api')->check()){ throw new AccessUnauthorisedException(); }
|
||||
|
||||
} catch (Exception $exception) {
|
||||
} catch (Exception) {
|
||||
|
||||
return (new ApiResponseObject('Authentication', 'To keep your account secure we need to re-validate your account', HttpStatus::ACCESS_UNAUTHORISED))->handler();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user