Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
namespace BimLib\PbiApi; use BimLib\Core\App; use BimLib\PbiApi\Exception\PbiApiException..
Decoded Output download
<? namespace BimLib\PbiApi; use BimLib\Core\App; use BimLib\PbiApi\Exception\PbiApiException; use BimLib\PbiApi\Exception\PbiRequestException; use BimLib\Core\Log; use BimLib\Core\Log\LoggerAdapter; use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\HandlerStack; use GuzzleHttp\Middleware; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use Firebase\JWT\JWT; class Azure extends \TheNetworg\OAuth2\Client\Provider\Azure { private $keys; private $tenantDetails = array(); protected $logMessageFormat = "{method} {host}{target} - {code} SN:{req_header_X-PowerBI-PushData-SequenceNumber} ClintId:{req_header_X-PowerBI-PushData-ClientId} Err:{res_header_X-PowerBI-Error-Info} Retry-After:{res_header_Retry-After}"; public function __construct(array $JKLYn = array(), array $cHVrx = array()) { $this->urlAPI = $JKLYn["apiUrlGraph"]; $this->urlLogin = $JKLYn["apiUrlLogin"]; $RIdZP = App::getAppInstance()->isApiLogEnabled(); if ($RIdZP) { $XXMuN = new LoggerAdapter(new Log(PbiApi::API_LOG_AREA)); $uvMjf = HandlerStack::create(); $uvMjf->push(Middleware::log($XXMuN, new MessageFormatter($this->logMessageFormat))); $JKLYn["handler"] = $uvMjf; } parent::__construct($JKLYn, $cHVrx); } function getParsedResponse(RequestInterface $GHwiS) { try { return parent::getParsedResponse($GHwiS); } catch (ConnectException $m95HQ) { throw new PbiRequestException("Azure API Request Failed. " . $m95HQ->getMessage(), PbiRequestException::CODE_CONNECTION_ERROR, $m95HQ); } catch (RequestException $m95HQ) { throw new PbiRequestException("Azure API Request Failed. " . $m95HQ->getMessage(), PbiRequestException::CODE_UNKNOWN_ERROR, $m95HQ); } } protected function parseResponse(ResponseInterface $aZNlC) { try { $Ln9fU = (string) $aZNlC->getBody(); $XTAr8 = parent::parseResponse($aZNlC); } catch (\UnexpectedValueException $m95HQ) { if (empty($Ln9fU)) { $XTAr8 = ''; } } if (empty($XTAr8)) { $XTAr8 = ["empty_response" => true, "status_code" => $aZNlC->getStatusCode(), "headers" => $aZNlC->getHeaders()]; } return $XTAr8; } protected function checkResponse(ResponseInterface $aZNlC, $bYhey) : void { $fhKZY = $aZNlC->getStatusCode(); if ($fhKZY >= 400) { throw new PbiApiException("Azure API Error.", $aZNlC); } parent::checkResponse($aZNlC, $bYhey); } protected function getAllowedClientOptions(array $JKLYn) { $JKLYn = parent::getAllowedClientOptions($JKLYn); $JKLYn[] = "handler"; return $JKLYn; } public function validateAccessToken($LW78p) { if (!isset($this->keys)) { $this->keys = $this->getJwtVerificationKeys(); } $ggTs6 = (array) JWT::decode($LW78p, $this->keys, ["RS256"]); if ($this->getClientId() != $ggTs6["aud"] && $this->getClientId() != $ggTs6["appid"]) { throw new \RuntimeException("The client_id / audience is invalid!"); } if ($ggTs6["nbf"] > time() || $ggTs6["exp"] < time()) { throw new \RuntimeException("The id_token is invalid!"); } if ($this->tenant == "common") { $this->tenant = $ggTs6["tid"]; $voxHS = $this->_getTenantDetails($this->tenant); if ($ggTs6["iss"] != $voxHS["issuer"]) { throw new \RuntimeException("Invalid token issuer!"); } } else { $voxHS = $this->_getTenantDetails($this->tenant); if ($ggTs6["iss"] != $voxHS["issuer"]) { throw new \RuntimeException("Invalid token issuer!"); } } return $ggTs6; } private function _getTenantDetails($voxHS, $IFjbc = "1.0") { if (!isset($this->tenantDetails[$voxHS])) { $this->tenantDetails[$voxHS] = $this->getTenantDetails($voxHS, $IFjbc); } return $this->tenantDetails[$voxHS]; } } ?>
Did this file decode correctly?
Original Code
namespace BimLib\PbiApi; use BimLib\Core\App; use BimLib\PbiApi\Exception\PbiApiException; use BimLib\PbiApi\Exception\PbiRequestException; use BimLib\Core\Log; use BimLib\Core\Log\LoggerAdapter; use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use GuzzleHttp\HandlerStack; use GuzzleHttp\Middleware; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use Firebase\JWT\JWT; class Azure extends \TheNetworg\OAuth2\Client\Provider\Azure { private $keys; private $tenantDetails = array(); protected $logMessageFormat = "\x7b\155\x65\x74\150\x6f\144\175\x20\173\x68\x6f\x73\x74\175\173\164\x61\162\147\x65\164\175\40\55\40\173\143\157\x64\145\175\x20\123\x4e\x3a\x7b\162\x65\x71\137\150\x65\x61\144\145\162\137\x58\55\x50\x6f\x77\145\162\x42\x49\55\120\165\163\150\x44\141\164\x61\55\x53\145\x71\165\145\x6e\x63\145\116\165\x6d\x62\145\162\175\40\x43\x6c\x69\156\164\x49\x64\x3a\x7b\162\145\x71\137\x68\145\x61\x64\x65\x72\x5f\x58\x2d\120\x6f\x77\145\162\102\111\55\x50\x75\x73\150\x44\141\164\x61\x2d\x43\x6c\151\145\x6e\x74\111\x64\x7d\x20\105\x72\162\x3a\x7b\162\145\x73\137\x68\145\141\144\x65\x72\137\130\55\x50\x6f\167\145\x72\x42\111\55\x45\162\x72\157\162\55\x49\x6e\x66\157\x7d\x20\122\x65\164\162\x79\55\101\x66\164\x65\162\72\173\162\145\x73\x5f\x68\x65\141\x64\145\162\137\x52\145\164\x72\x79\55\x41\146\164\145\162\x7d"; public function __construct(array $JKLYn = array(), array $cHVrx = array()) { $this->urlAPI = $JKLYn["\x61\x70\x69\x55\x72\154\x47\x72\141\160\x68"]; $this->urlLogin = $JKLYn["\141\x70\x69\x55\162\154\114\x6f\x67\151\156"]; $RIdZP = App::getAppInstance()->isApiLogEnabled(); if ($RIdZP) { $XXMuN = new LoggerAdapter(new Log(PbiApi::API_LOG_AREA)); $uvMjf = HandlerStack::create(); $uvMjf->push(Middleware::log($XXMuN, new MessageFormatter($this->logMessageFormat))); $JKLYn["\x68\x61\x6e\x64\x6c\x65\162"] = $uvMjf; } parent::__construct($JKLYn, $cHVrx); } function getParsedResponse(RequestInterface $GHwiS) { try { return parent::getParsedResponse($GHwiS); } catch (ConnectException $m95HQ) { throw new PbiRequestException("\101\x7a\165\162\x65\x20\x41\x50\111\40\122\x65\x71\165\x65\x73\164\x20\x46\141\x69\x6c\145\x64\56\40" . $m95HQ->getMessage(), PbiRequestException::CODE_CONNECTION_ERROR, $m95HQ); } catch (RequestException $m95HQ) { throw new PbiRequestException("\x41\172\165\162\x65\40\x41\120\x49\40\x52\x65\x71\x75\x65\163\x74\x20\x46\141\151\x6c\145\x64\x2e\40" . $m95HQ->getMessage(), PbiRequestException::CODE_UNKNOWN_ERROR, $m95HQ); } } protected function parseResponse(ResponseInterface $aZNlC) { try { $Ln9fU = (string) $aZNlC->getBody(); $XTAr8 = parent::parseResponse($aZNlC); } catch (\UnexpectedValueException $m95HQ) { if (empty($Ln9fU)) { $XTAr8 = ''; } } if (empty($XTAr8)) { $XTAr8 = ["\145\x6d\x70\164\171\137\162\145\x73\x70\x6f\156\163\x65" => true, "\x73\x74\x61\164\x75\163\x5f\x63\x6f\x64\x65" => $aZNlC->getStatusCode(), "\150\x65\x61\144\x65\x72\x73" => $aZNlC->getHeaders()]; } return $XTAr8; } protected function checkResponse(ResponseInterface $aZNlC, $bYhey) : void { $fhKZY = $aZNlC->getStatusCode(); if ($fhKZY >= 400) { throw new PbiApiException("\101\172\x75\x72\145\x20\x41\120\111\40\x45\x72\162\x6f\x72\56", $aZNlC); } parent::checkResponse($aZNlC, $bYhey); } protected function getAllowedClientOptions(array $JKLYn) { $JKLYn = parent::getAllowedClientOptions($JKLYn); $JKLYn[] = "\150\141\156\144\154\145\162"; return $JKLYn; } public function validateAccessToken($LW78p) { if (!isset($this->keys)) { $this->keys = $this->getJwtVerificationKeys(); } $ggTs6 = (array) JWT::decode($LW78p, $this->keys, ["\x52\x53\x32\65\66"]); if ($this->getClientId() != $ggTs6["\x61\x75\144"] && $this->getClientId() != $ggTs6["\141\160\160\x69\144"]) { throw new \RuntimeException("\124\x68\145\x20\x63\154\151\x65\156\164\x5f\x69\144\x20\x2f\40\141\165\x64\x69\x65\156\x63\145\x20\151\x73\40\151\156\x76\141\x6c\151\x64\41"); } if ($ggTs6["\156\142\x66"] > time() || $ggTs6["\x65\x78\160"] < time()) { throw new \RuntimeException("\x54\x68\145\40\x69\144\137\x74\157\x6b\145\156\x20\151\x73\40\151\156\166\x61\154\151\144\41"); } if ($this->tenant == "\x63\157\155\155\157\156") { $this->tenant = $ggTs6["\x74\151\144"]; $voxHS = $this->_getTenantDetails($this->tenant); if ($ggTs6["\x69\163\x73"] != $voxHS["\151\x73\163\165\x65\x72"]) { throw new \RuntimeException("\x49\156\166\x61\154\151\144\x20\164\x6f\x6b\145\156\40\x69\163\x73\165\145\162\41"); } } else { $voxHS = $this->_getTenantDetails($this->tenant); if ($ggTs6["\151\x73\x73"] != $voxHS["\151\x73\163\x75\x65\162"]) { throw new \RuntimeException("\111\x6e\x76\141\x6c\151\144\40\164\157\153\x65\156\x20\x69\163\x73\165\145\162\41"); } } return $ggTs6; } private function _getTenantDetails($voxHS, $IFjbc = "\x31\56\60") { if (!isset($this->tenantDetails[$voxHS])) { $this->tenantDetails[$voxHS] = $this->getTenantDetails($voxHS, $IFjbc); } return $this->tenantDetails[$voxHS]; } }
Function Calls
None |
Stats
MD5 | 048b2790bd048f5f2e0a1e043867a227 |
Eval Count | 0 |
Decode Time | 52 ms |