From 5d34201579db23cc54b0d2477c4cf230e2a16588 Mon Sep 17 00:00:00 2001 From: glovetleong Date: Tue, 28 Sep 2021 22:07:19 +0800 Subject: [PATCH] pull --- .../Services/CrossAuthenticatesUser.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/Classes/Modules/Accounts/Services/CrossAuthenticatesUser.php b/app/Classes/Modules/Accounts/Services/CrossAuthenticatesUser.php index acf1f15e..e80bef3d 100644 --- a/app/Classes/Modules/Accounts/Services/CrossAuthenticatesUser.php +++ b/app/Classes/Modules/Accounts/Services/CrossAuthenticatesUser.php @@ -6,7 +6,6 @@ use Illuminate\Support\Facades\Http; use App\Classes\Exceptions\AccessUnauthorisedException; use App\Classes\Modules\Accounts\DataTransferObjects\CrossAuthenticationCredentialsObject; use App\Classes\ValueObjects\Constants\PlatformType; - use Tymon\JWTAuth\Facades\JWTAuth; class CrossAuthenticatesUser { @@ -21,20 +20,21 @@ class CrossAuthenticatesUser if ($object->getPlatform() == PlatformType::EXCHANGE) { + $token = $object->getAccessToken(); + $tokenParts = explode(".", $token); + $tokenHeader = base64_decode($tokenParts[0]); + $tokenPayload = base64_decode($tokenParts[1]); + $jwtHeader = json_decode($tokenHeader); + $jwtPayload = json_decode($tokenPayload); + dd($jwtPayload); - $response = Http::withToken('eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC9leGNoYW5nZS0yLjAudGVzdFwvYXBpXC92MVwvYWNjb3VudFwvYXV0aGVudGljYXRpb25cL2xvZ2luXC9hdHRlbXB0IiwiaWF0IjoxNjMyODAwMzE1LCJleHAiOjk5NjA2MDAzMjE1LCJuYmYiOjE2MzI4MDAzMTUsImp0aSI6Ilo2cGpNMExRbWM5Q1BQQ0YiLCJ1c2VyIjp7ImlkIjo3LCJuYW1lIjoiTGVvbmcgQ2hlZSBTaW9uZyIsImVtYWlsIjoiZ2xvdmV0bGVvbmdAZ21haWwuY29tIiwidHlwZSI6Mywic3RhdHVzIjoyLCJjb21wYW55X2lkIjo5fSwic3ViIjo3LCJwcnYiOiIyM2JkNWM4OTQ5ZjYwMGFkYjM5ZTcwMWM0MDA4NzJkYjdhNTk3NmY3In0.j_Zr9r6W7gE7zM66NQQk9eHbzHPIz-BYbsVOE7ARukI')->get('http://exchange-2.0.test/api/v1/account/user/list')->object(); - + $response = Http::withToken($object->getAccessToken())->post('https://dev.exchange.cief-malaysia.com/api/v1/account/authentication/user/show')->object(); dd($response, $object->getAccessToken()); - } - if (! auth()->validate(['email' => $object->getEmail(), 'password' => $object->getPassword()])) { - throw new AccessUnauthorisedException('These credentials do not match our records.'); - } - - return true; + return $response; }