mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-08-25 15:34:24 +00:00
41 lines
1.2 KiB
PHP
41 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Accounts\Services;
|
|
|
|
use Illuminate\Support\Facades\Http;
|
|
use App\Classes\Exceptions\AccessUnauthorisedException;
|
|
use App\Classes\Modules\Accounts\DataTransferObjects\CrossAuthenticationCredentialsObject;
|
|
use App\Classes\ValueObjects\Constants\PlatformType;
|
|
|
|
class CrossAuthenticatesUser
|
|
{
|
|
|
|
/**
|
|
* @param CrossAuthenticationCredentialsObject $object
|
|
* @return false|string
|
|
* @throws AccessUnauthorisedException
|
|
*/
|
|
|
|
public function execute(CrossAuthenticationCredentialsObject $object){
|
|
|
|
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($object->getAccessToken())->post('https://dev.exchange.cief-malaysia.com/api/v1/account/authentication/user/show')->object();
|
|
|
|
dd($response, $object->getAccessToken());
|
|
}
|
|
|
|
return $response;
|
|
|
|
}
|
|
|
|
} |