<?php
namespace Claromentis\Login\UseCase;

$GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"] = (@$GLOBALS["__65da1b1ec2d" . "6653e8a0ab784" . "8e536215"] ?: array()) + array("_e6e01b6908a0508cd17588accda4d6f" . "e" => base64_decode("Y29yZS" . "5wcmVf" . "bG9naW" . "4="), "_4278f6e1f1e27cc1e96763e46" . "20a4ff5" => base64_decode("Y21" . "fZG" . "ll"), "_71d3614b60bf3de7b71d" . "5f42db4250a7" => base64_decode("c2VjdXJpdHkubG9naW5faG" . "FuZGxlcnM="), "_cf5abdeace819" . "3bc8ec0e86ed05" . "393e9" => base64_decode("JyBpcyBub3QgYW4gaW5zdGFuY2Ugb2YgTG" . "9naW5IYW5kbGVyIGNsYXNz"), "_4d707fab93beb" . "b00bbe69e81596" . "97c90" => base64_decode(""), "_dcf86ccc31a" . "f7f63af36115" . "aa12b1ee7" => base64_decode("Y2hk" . "aXI="), "_5859eb7a2f60" . "77879d670a31a" . "0a73fdc" => base64_decode("Y29yZS5jb21t" . "b25fcGF0aA=="), "_c51bc96058fbdb" . "f4c2ef19b306d1a" . "124" => base64_decode("Y2xhc3Nf" . "ZXhpc3Rz"), "_9c7b2c89f54c62da1b4ea7a8" . "7c66398b" => base64_decode("JyBkb2Vzbid0IGV4aXN0IG9yIGNhbid0IGJlIGZvdW" . "5kIGJ5IGF1dG9sb2FkZXI="), "_9342063570b40df" . "2075204394b59df5" . "9" => base64_decode("Z2V0Y3" . "dk"), "_b900ff57c02d0c49" . "6c3d0671e0c7ab71" => base64_decode("aHR0cF9mdW5jdGlvbnMucG" . "hw"), "_7d2af9f79e966585d5db71e50d3916" . "58" => base64_decode("RmF0YWwgY29uZmlndXJhdGlvbiBl" . "cnJvcjogbG9naW4gaGFuZGxlciAn"));
use AuthUserException;
use Claromentis\Core\Security\LoginAttemptResult;
use Claromentis\Core\Services;
use DateClaTimeZone;
use LoginHandler;
use Psr\Http\Message\ServerRequestInterface;




class IdentifyUser
{
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    public function TryLogin(ServerRequestInterface $request, $login_handlers = null)
    {
        if (empty($login_handlers)) {
            
            
            $login_handlers = $this->GetLoginHandlers();
        }
        $_6c544202e5fe8024f9a198d70c6583c8 = $this->RunLoginHandlers($request, $login_handlers);
        return $_6c544202e5fe8024f9a198d70c6583c8;
    }
    protected function RunLoginHandlers(ServerRequestInterface $request, $login_handlers)
    {
        $_7a53ecb3757f11638f8342261a2569f8 = null;
        $user_id = null;
        $_5435a6115c6c5b4d1178bffeb575351c = Services::I()->{$GLOBALS["__65da1b1ec2d6653e" . "8a0ab7848e536215"]["_5859eb7a2f6" . "077879d670a3" . "1a0a73fdc"]};
        $_63702fd1337dcda2ea5c6ebb54f4a1ae = $GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_9342063570b40df2075204394b59" . "df59"]();
        $GLOBALS["__65da1b1ec" . "2d6653e8a0a" . "b7848e53621" . "5"]["_dcf86cc" . "c31af7f6" . "3af36115" . "aa12b1ee" . "7"]($_5435a6115c6c5b4d1178bffeb575351c);
        
        
        require_once $GLOBALS["__65da1b1ec2d6653e8a0ab7" . "848e536215"]["_b900ff57c02d0c" . "496c3d0671e0c7a" . "b71"];
        
        
        DateClaTimeZone::SetCurrentTZ($GLOBALS["__65da1b1" . "ec2d6653e" . "8a0ab7848" . "e536215"]["_4d707fab93" . "bebb00bbe69" . "e8159697c90"]);
        
        
        $_d1652054f676bf08e82bb17ed1fc552a = null;
        $_fd49cb84d99503865ff1d549e2ec26e9 = LoginHandler::NO_DATA;
        $event = new \Claromentis\Core\Login\PreLoginEvent($login_handlers);
        \Claromentis\Core\Event\EventDispatcher::Shared()->dispatch($GLOBALS["__65da1b1ec2d6653e8a0ab7848e53" . "6215"]["_e6e01b6908a0508cd17588accda4d6f" . "e"], $event);
        $login_handlers = $event->login_handlers;
        foreach ($login_handlers as $_cf58d50fa50aab09e047075c4b2206cd) {
            if (!$GLOBALS["__65da1b1ec2d6653e8a0ab78" . "48e536215"]["_c51bc96058" . "fbdbf4c2ef1" . "9b306d1a124"]($_cf58d50fa50aab09e047075c4b2206cd)) {
                $GLOBALS["__65da1b1ec2d6653e8a0ab7848" . "e536215"]["_4278f6e1f1" . "e27cc1e9676" . "3e4620a4ff5"]($GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["_7d2af9f79e9" . "66585d5db71e" . "50d391658"] . $_cf58d50fa50aab09e047075c4b2206cd . $GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["_9c7b2c89f54c62da1b4ea7a" . "87c66398b"]);
            }
            $_d1652054f676bf08e82bb17ed1fc552a = new $_cf58d50fa50aab09e047075c4b2206cd();
            
            
            if (!$_d1652054f676bf08e82bb17ed1fc552a instanceof LoginHandler) {
                $GLOBALS["__65da1b1ec2d66" . "53e8a0ab7848e53" . "6215"]["_4278f6e1f1e27cc1e96" . "763e4620a4ff5"]($GLOBALS["__65da1b1ec2d6653e8a0a" . "b7848e536215"]["_7d2af9f79e966585d5db71e50d3" . "91658"] . $_cf58d50fa50aab09e047075c4b2206cd . $GLOBALS["__65da1b1ec2d6653e8a0ab784" . "8e536215"]["_cf5abdeace8193b" . "c8ec0e86ed05393e" . "9"]);
            }
            $_fd49cb84d99503865ff1d549e2ec26e9 = $_d1652054f676bf08e82bb17ed1fc552a->TryLogin();
            switch ($_fd49cb84d99503865ff1d549e2ec26e9) {
                case LoginHandler::NEW_USER:
                case LoginHandler::SYNC_USER:
                case LoginHandler::SUCCESS:
                case LoginHandler::FAILURE:
                    break 2;
                case LoginHandler::NO_DATA:
                default:
                    break;
            }
        }
        $_6c544202e5fe8024f9a198d70c6583c8 = $_d1652054f676bf08e82bb17ed1fc552a->GetLoginResult($_fd49cb84d99503865ff1d549e2ec26e9);
        $GLOBALS["__65da1b1ec2d6653e8" . "a0ab7848e536215"]["_dcf86ccc31af7f63af36115aa12b1ee" . "7"]($_63702fd1337dcda2ea5c6ebb54f4a1ae);
        return $_6c544202e5fe8024f9a198d70c6583c8;
    }
    
    
    
    
    
    
    public function GetLoginHandlers()
    {
        global $g_application;
        $login_handlers = $g_application[$GLOBALS["__65da1b1ec2d6653e8a0ab7848e53621" . "5"]["_71d3614b60bf3de7b71" . "d5f42db4250a7"]];
        return $login_handlers;
    }
}