Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php namespace MiniOrange\OAuth\Controller\Actions; use Magento\Customer\Model\Se..

Decoded Output download

<?php 
 
 
namespace MiniOrange\OAuth\Controller\Actions; 
 
use Magento\Customer\Model\Session; 
use Magento\Framework\App\Action\Context; 
use Magento\Framework\App\Action\HttpPostActionInterface; 
use Magento\Framework\App\ResponseFactory; 
use MiniOrange\OAuth\Helper\OAuthUtility; 
use MiniOrange\OAuth\Helper\OAuthConstants; 
use Magento\Framework\Controller\Result\JsonFactory; 
class CustomerLoginAction extends BaseAction implements HttpPostActionInterface 
{ 
    private $user; 
    private $customerSession; 
    protected $tokenModelFactory; 
    private $relayState; 
    private $app_name; 
    private $isHeadlessSSOEnabled; 
    public function __construct(Context $B2, OAuthUtility $Nq, Session $sy, \Magento\Integration\Model\Oauth\TokenFactory $EE) 
    { 
        $this->customerSession = $sy; 
        $this->tokenModelFactory = $EE; 
        $this->oauthUtility = $Nq; 
        parent::__construct($B2, $Nq); 
    } 
    public function execute() 
    { 
        $this->oauthUtility->log_debug("CustomerLoginAction: execute"); 
        if (isset($this->relayState)) { 
            goto PE; 
        } 
        $this->relayState = $this->oauthUtility->getBaseUrl() . "customer/account"; 
        PE: 
        $this->oauthUtility->setStoreConfig(OAuthConstants::DEFAULT_POST_LOGOUT, $this->relayState); 
        //$cq = $this->user->getId(); 
        //$this->oauthUtility->update_customer_id_in_customer_visitor($cq); 
        $Xo = $this->oauthUtility->getSessionData(OAuthConstants::APP_NAME); 
        $yx = $this->oauthUtility->getOAuthClientApps(); 
        $jq = null; 
        foreach ($yx as $Rm) { 
            if (!($Rm->getData()["app_name"] === $Xo)) { 
                goto D6; 
            } 
            $jq = $Rm->getData(); 
            D6: 
            Wo: 
        } 
        o4: 
        //$this->customerSession->setCustomerAsLoggedIn($this->user); 
 
        //$this->messageManager->addSuccessMessage('User: ' . json_encode($this->user->getData())); 
        $w7 = $jq["mo_oauth_headless_sso"]; 
        if (!$w7) { 
            goto Fi; 
        } 
        $this->oauthUtility->log_debug("CustomerLoginAction: HeadLessSSO Enabled session "); 
        if ($this->customerSession->isLoggedIn()) { 
            goto nX; 
        } 
        return $this->getResponse()->setBody(["error" => "Customer not logged in"]); 
        goto RM; 
        nX: 
        $this->oauthUtility->log_debug("CustomerLoginAction: Customer session exists"); 
        $H5 = $this->customerSession->getCustomer()->getId(); 
        $this->oauthUtility->log_debug("CustomerLoginAction: CustomerID ", $H5); 
        $q2 = $this->generateCustomerToken($H5); 
        $this->oauthUtility->log_debug("CustomerLoginAction: customerToken ", $q2); 
        if ($q2) { 
            goto da; 
        } 
        return $this->getResponse()->setBody(["error" => "Failed to generate customer token"]); 
        goto x2; 
        da: 
        $this->oauthUtility->log_debug("CustomerLoginAction: Inside Set data ", $H5); 
        $this->getResponse()->setHeader("Authorization", "Bearer " . $q2); 
        return $this->getResponse()->setBody("Authorization', 'Bearer " . $q2); 
        x2: 
        RM: 
        Fi: 
        return $this->getResponse()->setRedirect($this->oauthUtility->getUrl($this->relayState))->sendResponse(); 
    } 
    public function setUser($user) 
    { 
        $this->oauthUtility->log_debug("CustomerLoginAction: setUser"); 
        $this->user = $user; 
        return $this; 
    } 
    private function generateCustomerToken($H5) 
    { 
        try { 
            $q2 = $this->tokenModelFactory->create()->createCustomerToken($H5)->getToken(); 
            $this->oauthUtility->log_debug("CustomerLoginAction: Customer token created"); 
            return $q2; 
        } catch (\Exception $zQ) { 
            $this->oauthUtility->log_error("CustomerLoginAction: Token creation error - " . $zQ->getMessage()); 
            return null; 
        } 
    } 
    public function setRelayState($hq) 
    { 
        $this->oauthUtility->log_debug("CustomerLoginAction: setRelayState"); 
        $this->relayState = $hq; 
        return $this; 
    } 
} ?>

Did this file decode correctly?

Original Code

<?php


namespace MiniOrange\OAuth\Controller\Actions;

use Magento\Customer\Model\Session;
use Magento\Framework\App\Action\Context;
use Magento\Framework\App\Action\HttpPostActionInterface;
use Magento\Framework\App\ResponseFactory;
use MiniOrange\OAuth\Helper\OAuthUtility;
use MiniOrange\OAuth\Helper\OAuthConstants;
use Magento\Framework\Controller\Result\JsonFactory;
class CustomerLoginAction extends BaseAction implements HttpPostActionInterface
{
    private $user;
    private $customerSession;
    protected $tokenModelFactory;
    private $relayState;
    private $app_name;
    private $isHeadlessSSOEnabled;
    public function __construct(Context $B2, OAuthUtility $Nq, Session $sy, \Magento\Integration\Model\Oauth\TokenFactory $EE)
    {
        $this->customerSession = $sy;
        $this->tokenModelFactory = $EE;
        $this->oauthUtility = $Nq;
        parent::__construct($B2, $Nq);
    }
    public function execute()
    {
        $this->oauthUtility->log_debug("\103\165\163\x74\x6f\x6d\x65\x72\x4c\x6f\147\151\x6e\x41\143\164\x69\157\156\x3a\40\x65\170\145\x63\x75\x74\145");
        if (isset($this->relayState)) {
            goto PE;
        }
        $this->relayState = $this->oauthUtility->getBaseUrl() . "\x63\165\163\164\157\x6d\x65\x72\x2f\x61\x63\143\x6f\165\x6e\x74";
        PE:
        $this->oauthUtility->setStoreConfig(OAuthConstants::DEFAULT_POST_LOGOUT, $this->relayState);
        //$cq = $this->user->getId();
        //$this->oauthUtility->update_customer_id_in_customer_visitor($cq);
        $Xo = $this->oauthUtility->getSessionData(OAuthConstants::APP_NAME);
        $yx = $this->oauthUtility->getOAuthClientApps();
        $jq = null;
        foreach ($yx as $Rm) {
            if (!($Rm->getData()["\141\160\160\x5f\156\x61\x6d\x65"] === $Xo)) {
                goto D6;
            }
            $jq = $Rm->getData();
            D6:
            Wo:
        }
        o4:
        //$this->customerSession->setCustomerAsLoggedIn($this->user);

        //$this->messageManager->addSuccessMessage('User: ' . json_encode($this->user->getData()));
        $w7 = $jq["\155\x6f\x5f\157\141\x75\x74\x68\x5f\x68\145\x61\x64\x6c\145\x73\163\x5f\163\163\x6f"];
        if (!$w7) {
            goto Fi;
        }
        $this->oauthUtility->log_debug("\x43\165\163\164\x6f\x6d\145\x72\x4c\157\x67\151\156\x41\143\164\x69\x6f\x6e\x3a\40\x48\x65\141\x64\114\x65\x73\x73\123\x53\x4f\x20\x45\x6e\141\142\154\x65\144\x20\163\145\163\x73\151\157\x6e\40");
        if ($this->customerSession->isLoggedIn()) {
            goto nX;
        }
        return $this->getResponse()->setBody(["\145\x72\162\x6f\162" => "\103\x75\163\164\157\155\145\162\40\156\157\164\40\154\x6f\147\147\x65\x64\40\151\156"]);
        goto RM;
        nX:
        $this->oauthUtility->log_debug("\x43\165\163\164\x6f\x6d\x65\x72\x4c\x6f\x67\151\x6e\101\143\x74\x69\157\156\72\40\103\x75\163\164\157\155\x65\162\x20\163\145\x73\163\x69\x6f\156\40\x65\170\x69\163\x74\x73");
        $H5 = $this->customerSession->getCustomer()->getId();
        $this->oauthUtility->log_debug("\103\x75\x73\164\157\155\145\x72\x4c\157\147\151\x6e\x41\143\x74\x69\x6f\x6e\x3a\x20\103\x75\163\x74\157\155\145\162\111\104\x20", $H5);
        $q2 = $this->generateCustomerToken($H5);
        $this->oauthUtility->log_debug("\103\165\163\164\x6f\x6d\x65\162\114\157\147\151\x6e\x41\143\164\x69\157\156\x3a\x20\x63\x75\163\164\157\155\x65\x72\x54\157\x6b\x65\x6e\40", $q2);
        if ($q2) {
            goto da;
        }
        return $this->getResponse()->setBody(["\145\x72\162\x6f\x72" => "\x46\141\x69\x6c\145\144\40\164\157\40\x67\145\x6e\x65\162\x61\x74\145\40\x63\x75\x73\x74\x6f\x6d\x65\x72\40\164\157\x6b\145\156"]);
        goto x2;
        da:
        $this->oauthUtility->log_debug("\103\165\x73\164\157\155\x65\x72\x4c\x6f\147\x69\x6e\101\143\x74\x69\x6f\x6e\x3a\40\x49\156\x73\x69\144\145\x20\123\145\164\x20\144\x61\x74\141\40", $H5);
        $this->getResponse()->setHeader("\101\x75\164\x68\157\x72\x69\x7a\141\x74\151\157\x6e", "\102\145\141\162\145\162\40" . $q2);
        return $this->getResponse()->setBody("\x41\165\164\150\x6f\162\151\172\141\x74\x69\x6f\x6e\47\54\40\47\102\x65\x61\162\x65\162\40" . $q2);
        x2:
        RM:
        Fi:
        return $this->getResponse()->setRedirect($this->oauthUtility->getUrl($this->relayState))->sendResponse();
    }
    public function setUser($user)
    {
        $this->oauthUtility->log_debug("\x43\165\x73\164\157\155\x65\162\x4c\x6f\x67\151\x6e\101\x63\x74\151\157\x6e\x3a\40\163\145\164\x55\x73\x65\162");
        $this->user = $user;
        return $this;
    }
    private function generateCustomerToken($H5)
    {
        try {
            $q2 = $this->tokenModelFactory->create()->createCustomerToken($H5)->getToken();
            $this->oauthUtility->log_debug("\x43\165\163\164\157\155\145\162\114\157\147\x69\156\101\143\164\x69\157\x6e\72\x20\103\x75\x73\x74\x6f\x6d\145\x72\40\164\x6f\x6b\x65\x6e\40\x63\x72\145\141\x74\x65\x64");
            return $q2;
        } catch (\Exception $zQ) {
            $this->oauthUtility->log_error("\x43\x75\163\x74\157\155\x65\162\x4c\157\147\151\156\x41\143\x74\x69\x6f\156\72\x20\124\157\153\x65\x6e\x20\143\x72\x65\141\x74\151\x6f\156\40\145\162\x72\x6f\162\40\x2d\x20" . $zQ->getMessage());
            return null;
        }
    }
    public function setRelayState($hq)
    {
        $this->oauthUtility->log_debug("\103\165\x73\x74\157\x6d\145\162\114\x6f\147\x69\156\x41\143\164\151\x6f\x6e\72\x20\163\145\164\x52\x65\x6c\141\171\123\x74\141\164\145");
        $this->relayState = $hq;
        return $this;
    }
}

Function Calls

None

Variables

None

Stats

MD5 1ea00d663d805580492410fb8b6dd57d
Eval Count 0
Decode Time 58 ms