From aee1d26df8f2bdddb9ff909abd84a1b0bce91230 Mon Sep 17 00:00:00 2001 From: Cameron Date: Sun, 20 Dec 2020 17:50:56 -0800 Subject: [PATCH] HybridAuth and PHPMailer updated. --- composer.lock | 211 ++++- .../vendor/composer/InstalledVersions.php | 34 +- .../vendor/composer/autoload_psr4.php | 2 + .../vendor/composer/autoload_static.php | 17 + e107_handlers/vendor/composer/installed.json | 217 ++++- e107_handlers/vendor/composer/installed.php | 34 +- .../hybridauth/hybridauth/CONTRIBUTING.md | 6 +- .../vendor/hybridauth/hybridauth/COPYING.md | 6 +- .../vendor/hybridauth/hybridauth/README.md | 8 +- .../hybridauth/hybridauth/examples/README.md | 12 - .../hybridauth/examples/example_01.php | 190 ----- .../hybridauth/examples/example_02.php | 76 -- .../hybridauth/examples/example_03.php | 33 - .../hybridauth/examples/example_04.php | 32 - .../hybridauth/examples/example_05.php | 33 - .../examples/example_06/callback.php | 59 -- .../hybridauth/examples/example_06/config.php | 35 - .../hybridauth/examples/example_06/index.php | 49 -- .../examples/example_07/callback.php | 97 --- .../hybridauth/examples/example_07/config.php | 27 - .../hybridauth/examples/example_07/index.php | 61 -- .../hybridauth/hybridauth/examples/index.html | 1 - .../src/Adapter/AbstractAdapter.php | 59 +- .../src/Adapter/AdapterInterface.php | 4 +- .../hybridauth/src/Adapter/DataStoreTrait.php | 10 +- .../hybridauth/src/Adapter/OAuth1.php | 496 +++++------ .../hybridauth/src/Adapter/OAuth2.php | 777 ++++++++++-------- .../hybridauth/src/Adapter/OpenID.php | 172 ++-- .../hybridauth/src/Data/Collection.php | 106 +-- .../hybridauth/hybridauth/src/Data/Parser.php | 60 +- .../hybridauth/src/Exception/Exception.php | 22 +- .../hybridauth/src/HttpClient/Curl.php | 216 ++--- .../hybridauth/src/HttpClient/Guzzle.php | 154 ++-- .../src/HttpClient/HttpClientInterface.php | 60 +- .../hybridauth/src/HttpClient/Util.php | 50 +- .../hybridauth/hybridauth/src/Hybridauth.php | 176 ++-- .../hybridauth/src/Logger/Logger.php | 10 +- .../hybridauth/src/Logger/LoggerInterface.php | 10 +- .../hybridauth/src/Provider/AOLOpenID.php | 13 +- .../hybridauth/src/Provider/Amazon.php | 6 +- .../hybridauth/src/Provider/Authentiq.php | 77 +- .../hybridauth/src/Provider/BitBucket.php | 47 +- .../hybridauth/src/Provider/Blizzard.php | 4 +- .../hybridauth/src/Provider/Discord.php | 13 +- .../hybridauth/src/Provider/Disqus.php | 40 +- .../hybridauth/src/Provider/Dribbble.php | 32 +- .../hybridauth/src/Provider/Facebook.php | 87 +- .../hybridauth/src/Provider/Foursquare.php | 52 +- .../hybridauth/src/Provider/GitHub.php | 3 +- .../hybridauth/src/Provider/GitLab.php | 38 +- .../hybridauth/src/Provider/Google.php | 94 +-- .../hybridauth/src/Provider/LinkedIn.php | 29 +- .../hybridauth/src/Provider/Mailru.php | 26 +- .../src/Provider/MicrosoftGraph.php | 83 +- .../hybridauth/src/Provider/ORCID.php | 34 +- .../hybridauth/src/Provider/Odnoklassniki.php | 87 +- .../hybridauth/src/Provider/OpenID.php | 9 +- .../hybridauth/src/Provider/Patreon.php | 18 +- .../hybridauth/src/Provider/Paypal.php | 79 +- .../hybridauth/src/Provider/PaypalOpenID.php | 21 +- .../hybridauth/hybridauth/src/Provider/QQ.php | 18 +- .../hybridauth/src/Provider/Reddit.php | 41 +- .../hybridauth/src/Provider/Slack.php | 3 +- .../hybridauth/src/Provider/Spotify.php | 8 +- .../hybridauth/src/Provider/StackExchange.php | 64 +- .../src/Provider/StackExchangeOpenID.php | 19 +- .../hybridauth/src/Provider/Steam.php | 39 +- .../hybridauth/src/Provider/SteemConnect.php | 8 +- .../hybridauth/src/Provider/Strava.php | 6 +- .../hybridauth/src/Provider/Telegram.php | 70 +- .../hybridauth/src/Provider/Tumblr.php | 40 +- .../hybridauth/src/Provider/TwitchTV.php | 10 + .../hybridauth/src/Provider/Twitter.php | 85 +- .../hybridauth/src/Provider/Vkontakte.php | 46 +- .../hybridauth/src/Provider/WeChat.php | 44 +- .../hybridauth/src/Provider/WeChatChina.php | 1 - .../hybridauth/src/Provider/WindowsLive.php | 60 +- .../hybridauth/src/Provider/WordPress.php | 32 +- .../hybridauth/src/Provider/Yahoo.php | 113 +-- .../hybridauth/src/Provider/YahooOpenID.php | 37 - .../hybridauth/src/Provider/Yandex.php | 30 +- .../hybridauth/src/Storage/Session.php | 47 +- .../src/Storage/StorageInterface.php | 44 +- .../src/Thirdparty/OpenID/LightOpenID.php | 10 +- .../hybridauth/src/User/Activity.php | 48 +- .../hybridauth/src/User/Contact.php | 70 +- .../hybridauth/src/User/Profile.php | 198 ++--- .../hybridauth/hybridauth/src/autoload.php | 6 +- .../hybridauth/hybridauth/tests/Adapter/empty | 0 .../hybridauth/tests/Data/CollectionTest.php | 130 --- .../hybridauth/tests/Data/ParserTest.php | 77 -- .../hybridauth/tests/HttpClient/empty | 0 .../hybridauth/tests/HybridauthTest.php | 13 - .../hybridauth/hybridauth/tests/Logger/empty | 0 .../hybridauth/tests/Provider/empty | 0 .../hybridauth/tests/Storage/SessionTest.php | 124 --- .../hybridauth/tests/User/ActivityTest.php | 42 - .../hybridauth/tests/User/ContactTest.php | 48 -- .../hybridauth/tests/User/ProfileTest.php | 78 -- .../vendor/phpmailer/phpmailer/README.md | 10 +- .../vendor/phpmailer/phpmailer/VERSION | 2 +- .../vendor/phpmailer/phpmailer/composer.json | 22 +- .../phpmailer/phpmailer/get_oauth_token.php | 10 +- .../phpmailer/language/phpmailer.lang-af.php | 1 + .../phpmailer/language/phpmailer.lang-ar.php | 1 + .../phpmailer/language/phpmailer.lang-az.php | 1 + .../phpmailer/language/phpmailer.lang-ba.php | 3 +- .../phpmailer/language/phpmailer.lang-be.php | 1 + .../phpmailer/language/phpmailer.lang-bg.php | 1 + .../phpmailer/language/phpmailer.lang-ca.php | 1 + .../phpmailer/language/phpmailer.lang-ch.php | 1 + .../phpmailer/language/phpmailer.lang-cs.php | 1 + .../phpmailer/language/phpmailer.lang-da.php | 5 +- .../phpmailer/language/phpmailer.lang-de.php | 3 + .../phpmailer/language/phpmailer.lang-el.php | 1 + .../phpmailer/language/phpmailer.lang-eo.php | 1 + .../phpmailer/language/phpmailer.lang-es.php | 1 + .../phpmailer/language/phpmailer.lang-et.php | 1 + .../phpmailer/language/phpmailer.lang-fa.php | 1 + .../phpmailer/language/phpmailer.lang-fi.php | 1 + .../phpmailer/language/phpmailer.lang-fo.php | 1 + .../phpmailer/language/phpmailer.lang-fr.php | 3 + .../phpmailer/language/phpmailer.lang-gl.php | 1 + .../phpmailer/language/phpmailer.lang-he.php | 1 + .../phpmailer/language/phpmailer.lang-hi.php | 3 +- .../phpmailer/language/phpmailer.lang-hr.php | 1 + .../phpmailer/language/phpmailer.lang-hu.php | 1 + .../phpmailer/language/phpmailer.lang-hy.php | 3 +- .../phpmailer/language/phpmailer.lang-id.php | 28 +- .../phpmailer/language/phpmailer.lang-it.php | 1 + .../phpmailer/language/phpmailer.lang-ja.php | 1 + .../phpmailer/language/phpmailer.lang-ka.php | 1 + .../phpmailer/language/phpmailer.lang-ko.php | 1 + .../phpmailer/language/phpmailer.lang-lt.php | 1 + .../phpmailer/language/phpmailer.lang-lv.php | 1 + .../phpmailer/language/phpmailer.lang-mg.php | 2 + .../phpmailer/language/phpmailer.lang-ms.php | 1 + .../phpmailer/language/phpmailer.lang-nb.php | 1 + .../phpmailer/language/phpmailer.lang-nl.php | 1 + .../phpmailer/language/phpmailer.lang-pl.php | 3 +- .../phpmailer/language/phpmailer.lang-pt.php | 1 + .../language/phpmailer.lang-pt_br.php | 1 + .../phpmailer/language/phpmailer.lang-ro.php | 1 + .../phpmailer/language/phpmailer.lang-ru.php | 1 + .../phpmailer/language/phpmailer.lang-sk.php | 1 + .../phpmailer/language/phpmailer.lang-sl.php | 6 +- .../phpmailer/language/phpmailer.lang-sr.php | 1 + .../phpmailer/language/phpmailer.lang-sv.php | 5 +- .../phpmailer/language/phpmailer.lang-tl.php | 25 +- .../phpmailer/language/phpmailer.lang-tr.php | 1 + .../phpmailer/language/phpmailer.lang-uk.php | 1 + .../phpmailer/language/phpmailer.lang-vi.php | 1 + .../phpmailer/language/phpmailer.lang-zh.php | 1 + .../language/phpmailer.lang-zh_cn.php | 1 + .../phpmailer/phpmailer/src/Exception.php | 3 +- .../vendor/phpmailer/phpmailer/src/OAuth.php | 3 +- .../phpmailer/phpmailer/src/PHPMailer.php | 171 ++-- .../vendor/phpmailer/phpmailer/src/POP3.php | 43 +- .../vendor/phpmailer/phpmailer/src/SMTP.php | 116 ++- e107_tests/tests/unit/e_user_providerTest.php | 2 +- 160 files changed, 3159 insertions(+), 3574 deletions(-) delete mode 100644 e107_handlers/vendor/hybridauth/hybridauth/examples/README.md delete mode 100644 e107_handlers/vendor/hybridauth/hybridauth/examples/example_01.php delete mode 100644 e107_handlers/vendor/hybridauth/hybridauth/examples/example_02.php delete mode 100644 e107_handlers/vendor/hybridauth/hybridauth/examples/example_03.php delete mode 100644 e107_handlers/vendor/hybridauth/hybridauth/examples/example_04.php delete mode 100644 e107_handlers/vendor/hybridauth/hybridauth/examples/example_05.php delete mode 100644 e107_handlers/vendor/hybridauth/hybridauth/examples/example_06/callback.php delete mode 100644 e107_handlers/vendor/hybridauth/hybridauth/examples/example_06/config.php delete mode 100644 e107_handlers/vendor/hybridauth/hybridauth/examples/example_06/index.php delete mode 100644 e107_handlers/vendor/hybridauth/hybridauth/examples/example_07/callback.php delete mode 100644 e107_handlers/vendor/hybridauth/hybridauth/examples/example_07/config.php delete mode 100644 e107_handlers/vendor/hybridauth/hybridauth/examples/example_07/index.php delete mode 100644 e107_handlers/vendor/hybridauth/hybridauth/examples/index.html delete mode 100644 e107_handlers/vendor/hybridauth/hybridauth/src/Provider/YahooOpenID.php delete mode 100644 e107_handlers/vendor/hybridauth/hybridauth/tests/Adapter/empty delete mode 100644 e107_handlers/vendor/hybridauth/hybridauth/tests/Data/CollectionTest.php delete mode 100644 e107_handlers/vendor/hybridauth/hybridauth/tests/Data/ParserTest.php delete mode 100644 e107_handlers/vendor/hybridauth/hybridauth/tests/HttpClient/empty delete mode 100644 e107_handlers/vendor/hybridauth/hybridauth/tests/HybridauthTest.php delete mode 100644 e107_handlers/vendor/hybridauth/hybridauth/tests/Logger/empty delete mode 100644 e107_handlers/vendor/hybridauth/hybridauth/tests/Provider/empty delete mode 100644 e107_handlers/vendor/hybridauth/hybridauth/tests/Storage/SessionTest.php delete mode 100644 e107_handlers/vendor/hybridauth/hybridauth/tests/User/ActivityTest.php delete mode 100644 e107_handlers/vendor/hybridauth/hybridauth/tests/User/ContactTest.php delete mode 100644 e107_handlers/vendor/hybridauth/hybridauth/tests/User/ProfileTest.php diff --git a/composer.lock b/composer.lock index daf892e54..15d02a20c 100644 --- a/composer.lock +++ b/composer.lock @@ -6,6 +6,60 @@ ], "content-hash": "69374030afa61b1e84c6c973551b0e5f", "packages": [ + { + "name": "firebase/php-jwt", + "version": "v5.2.0", + "source": { + "type": "git", + "url": "https://github.com/firebase/php-jwt.git", + "reference": "feb0e820b8436873675fd3aca04f3728eb2185cb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/firebase/php-jwt/zipball/feb0e820b8436873675fd3aca04f3728eb2185cb", + "reference": "feb0e820b8436873675fd3aca04f3728eb2185cb", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": ">=4.8 <=9" + }, + "type": "library", + "autoload": { + "psr-4": { + "Firebase\\JWT\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Neuman Vong", + "email": "neuman+pear@twilio.com", + "role": "Developer" + }, + { + "name": "Anant Narayanan", + "email": "anant@php.net", + "role": "Developer" + } + ], + "description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.", + "homepage": "https://github.com/firebase/php-jwt", + "keywords": [ + "jwt", + "php" + ], + "support": { + "issues": "https://github.com/firebase/php-jwt/issues", + "source": "https://github.com/firebase/php-jwt/tree/master" + }, + "time": "2020-03-25T18:49:23+00:00" + }, { "name": "guzzlehttp/psr7", "version": "1.7.0", @@ -83,20 +137,22 @@ }, { "name": "hybridauth/hybridauth", - "version": "3.3.0", + "version": "3.6.0", "source": { "type": "git", "url": "https://github.com/hybridauth/hybridauth.git", - "reference": "51cb2ad2f04d175d298b51e919868dec1d4d8b04" + "reference": "222ab4e6ee6ffd81caa77283142f3aa97afa5863" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hybridauth/hybridauth/zipball/51cb2ad2f04d175d298b51e919868dec1d4d8b04", - "reference": "51cb2ad2f04d175d298b51e919868dec1d4d8b04", + "url": "https://api.github.com/repos/hybridauth/hybridauth/zipball/222ab4e6ee6ffd81caa77283142f3aa97afa5863", + "reference": "222ab4e6ee6ffd81caa77283142f3aa97afa5863", "shasum": "" }, "require": { - "php": ">=5.4.0" + "firebase/php-jwt": "*", + "php": ">=5.4.0", + "phpseclib/phpseclib": "~2.0" }, "require-dev": { "ext-curl": "*", @@ -124,6 +180,7 @@ "Authentication", "OpenId", "api", + "apple", "authorization", "facebook", "google", @@ -131,7 +188,12 @@ "social", "twitter" ], - "time": "2020-04-16T08:04:26+00:00" + "support": { + "gitter": "https://gitter.im/hybridauth/hybridauth", + "issues": "https://github.com/hybridauth/hybridauth/issues", + "source": "https://github.com/hybridauth/hybridauth/tree/3.6.0" + }, + "time": "2020-10-21T16:32:08+00:00" }, { "name": "ifsnop/mysqldump-php", @@ -186,6 +248,10 @@ "php5", "sql" ], + "support": { + "issues": "https://github.com/ifsnop/mysqldump-php/issues", + "source": "https://github.com/ifsnop/mysqldump-php/tree/master" + }, "time": "2020-04-03T14:40:40+00:00" }, { @@ -381,27 +447,31 @@ }, { "name": "phpmailer/phpmailer", - "version": "v6.1.6", + "version": "v6.2.0", "source": { "type": "git", "url": "https://github.com/PHPMailer/PHPMailer.git", - "reference": "c2796cb1cb99d7717290b48c4e6f32cb6c60b7b3" + "reference": "e38888a75c070304ca5514197d4847a59a5c853f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/c2796cb1cb99d7717290b48c4e6f32cb6c60b7b3", - "reference": "c2796cb1cb99d7717290b48c4e6f32cb6c60b7b3", + "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/e38888a75c070304ca5514197d4847a59a5c853f", + "reference": "e38888a75c070304ca5514197d4847a59a5c853f", "shasum": "" }, "require": { "ext-ctype": "*", "ext-filter": "*", + "ext-hash": "*", "php": ">=5.5.0" }, "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", "doctrine/annotations": "^1.2", - "friendsofphp/php-cs-fixer": "^2.2", - "phpunit/phpunit": "^4.8 || ^5.7" + "phpcompatibility/php-compatibility": "^9.3.5", + "roave/security-advisories": "dev-latest", + "squizlabs/php_codesniffer": "^3.5.6", + "yoast/phpunit-polyfills": "^0.2.0" }, "suggest": { "ext-mbstring": "Needed to send email in multibyte encoding charset", @@ -439,13 +509,126 @@ } ], "description": "PHPMailer is a full-featured email creation and transfer class for PHP", + "support": { + "issues": "https://github.com/PHPMailer/PHPMailer/issues", + "source": "https://github.com/PHPMailer/PHPMailer/tree/v6.2.0" + }, "funding": [ { - "url": "https://github.com/synchro", + "url": "https://github.com/Synchro", "type": "github" } ], - "time": "2020-05-27T12:24:03+00:00" + "time": "2020-11-25T15:24:57+00:00" + }, + { + "name": "phpseclib/phpseclib", + "version": "2.0.30", + "source": { + "type": "git", + "url": "https://github.com/phpseclib/phpseclib.git", + "reference": "136b9ca7eebef78be14abf90d65c5e57b6bc5d36" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/136b9ca7eebef78be14abf90d65c5e57b6bc5d36", + "reference": "136b9ca7eebef78be14abf90d65c5e57b6bc5d36", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phing/phing": "~2.7", + "phpunit/phpunit": "^4.8.35|^5.7|^6.0|^9.4", + "squizlabs/php_codesniffer": "~2.0" + }, + "suggest": { + "ext-gmp": "Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.", + "ext-libsodium": "SSH2/SFTP can make use of some algorithms provided by the libsodium-php extension.", + "ext-mcrypt": "Install the Mcrypt extension in order to speed up a few other cryptographic operations.", + "ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations." + }, + "type": "library", + "autoload": { + "files": [ + "phpseclib/bootstrap.php" + ], + "psr-4": { + "phpseclib\\": "phpseclib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jim Wigginton", + "email": "terrafrost@php.net", + "role": "Lead Developer" + }, + { + "name": "Patrick Monnerat", + "email": "pm@datasphere.ch", + "role": "Developer" + }, + { + "name": "Andreas Fischer", + "email": "bantu@phpbb.com", + "role": "Developer" + }, + { + "name": "Hans-Jürgen Petrich", + "email": "petrich@tronic-media.com", + "role": "Developer" + }, + { + "name": "Graham Campbell", + "email": "graham@alt-three.com", + "role": "Developer" + } + ], + "description": "PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.", + "homepage": "http://phpseclib.sourceforge.net", + "keywords": [ + "BigInteger", + "aes", + "asn.1", + "asn1", + "blowfish", + "crypto", + "cryptography", + "encryption", + "rsa", + "security", + "sftp", + "signature", + "signing", + "ssh", + "twofish", + "x.509", + "x509" + ], + "support": { + "issues": "https://github.com/phpseclib/phpseclib/issues", + "source": "https://github.com/phpseclib/phpseclib/tree/2.0.30" + }, + "funding": [ + { + "url": "https://github.com/terrafrost", + "type": "github" + }, + { + "url": "https://www.patreon.com/phpseclib", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpseclib/phpseclib", + "type": "tidelift" + } + ], + "time": "2020-12-17T05:42:04+00:00" }, { "name": "psr/http-message", diff --git a/e107_handlers/vendor/composer/InstalledVersions.php b/e107_handlers/vendor/composer/InstalledVersions.php index 563d40975..131fe2188 100644 --- a/e107_handlers/vendor/composer/InstalledVersions.php +++ b/e107_handlers/vendor/composer/InstalledVersions.php @@ -29,7 +29,7 @@ private static $installed = array ( 'aliases' => array ( ), - 'reference' => '1f38b3b3dd231c274f4df1a529883655108b611e', + 'reference' => '153cf33aa76c3378a8332616fe68fd796d00343b', 'name' => 'e107inc/e107', ), 'versions' => @@ -41,7 +41,16 @@ private static $installed = array ( 'aliases' => array ( ), - 'reference' => '1f38b3b3dd231c274f4df1a529883655108b611e', + 'reference' => '153cf33aa76c3378a8332616fe68fd796d00343b', + ), + 'firebase/php-jwt' => + array ( + 'pretty_version' => 'v5.2.0', + 'version' => '5.2.0.0', + 'aliases' => + array ( + ), + 'reference' => 'feb0e820b8436873675fd3aca04f3728eb2185cb', ), 'guzzlehttp/psr7' => array ( @@ -54,12 +63,12 @@ private static $installed = array ( ), 'hybridauth/hybridauth' => array ( - 'pretty_version' => '3.3.0', - 'version' => '3.3.0.0', + 'pretty_version' => '3.6.0', + 'version' => '3.6.0.0', 'aliases' => array ( ), - 'reference' => '51cb2ad2f04d175d298b51e919868dec1d4d8b04', + 'reference' => '222ab4e6ee6ffd81caa77283142f3aa97afa5863', ), 'ifsnop/mysqldump-php' => array ( @@ -99,12 +108,21 @@ private static $installed = array ( ), 'phpmailer/phpmailer' => array ( - 'pretty_version' => 'v6.1.6', - 'version' => '6.1.6.0', + 'pretty_version' => 'v6.2.0', + 'version' => '6.2.0.0', 'aliases' => array ( ), - 'reference' => 'c2796cb1cb99d7717290b48c4e6f32cb6c60b7b3', + 'reference' => 'e38888a75c070304ca5514197d4847a59a5c853f', + ), + 'phpseclib/phpseclib' => + array ( + 'pretty_version' => '2.0.30', + 'version' => '2.0.30.0', + 'aliases' => + array ( + ), + 'reference' => '136b9ca7eebef78be14abf90d65c5e57b6bc5d36', ), 'psr/http-message' => array ( diff --git a/e107_handlers/vendor/composer/autoload_psr4.php b/e107_handlers/vendor/composer/autoload_psr4.php index 8747983d0..c9e607212 100644 --- a/e107_handlers/vendor/composer/autoload_psr4.php +++ b/e107_handlers/vendor/composer/autoload_psr4.php @@ -6,6 +6,7 @@ $vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname(dirname($vendorDir)); return array( + 'phpseclib\\' => array($vendorDir . '/phpseclib/phpseclib/phpseclib'), 'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'), 'PHPMailer\\PHPMailer\\' => array($vendorDir . '/phpmailer/phpmailer/src'), 'MatthiasMullie\\PathConverter\\' => array($vendorDir . '/matthiasmullie/path-converter/src'), @@ -14,4 +15,5 @@ return array( 'Ifsnop\\' => array($vendorDir . '/ifsnop/mysqldump-php/src/Ifsnop'), 'Hybridauth\\' => array($vendorDir . '/hybridauth/hybridauth/src'), 'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'), + 'Firebase\\JWT\\' => array($vendorDir . '/firebase/php-jwt/src'), ); diff --git a/e107_handlers/vendor/composer/autoload_static.php b/e107_handlers/vendor/composer/autoload_static.php index ec9f14c4b..91a92421c 100644 --- a/e107_handlers/vendor/composer/autoload_static.php +++ b/e107_handlers/vendor/composer/autoload_static.php @@ -9,9 +9,14 @@ class ComposerStaticInit4ce406ae486ac58c9aa71537459207ae public static $files = array ( '7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php', 'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php', + 'decc78cc4436b1292c6c0d151b19445c' => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib/bootstrap.php', ); public static $prefixLengthsPsr4 = array ( + 'p' => + array ( + 'phpseclib\\' => 10, + ), 'P' => array ( 'Psr\\Http\\Message\\' => 17, @@ -35,9 +40,17 @@ class ComposerStaticInit4ce406ae486ac58c9aa71537459207ae array ( 'GuzzleHttp\\Psr7\\' => 16, ), + 'F' => + array ( + 'Firebase\\JWT\\' => 13, + ), ); public static $prefixDirsPsr4 = array ( + 'phpseclib\\' => + array ( + 0 => __DIR__ . '/..' . '/phpseclib/phpseclib/phpseclib', + ), 'Psr\\Http\\Message\\' => array ( 0 => __DIR__ . '/..' . '/psr/http-message/src', @@ -70,6 +83,10 @@ class ComposerStaticInit4ce406ae486ac58c9aa71537459207ae array ( 0 => __DIR__ . '/..' . '/guzzlehttp/psr7/src', ), + 'Firebase\\JWT\\' => + array ( + 0 => __DIR__ . '/..' . '/firebase/php-jwt/src', + ), ); public static $classMap = array ( diff --git a/e107_handlers/vendor/composer/installed.json b/e107_handlers/vendor/composer/installed.json index 92bf50539..c4893a969 100644 --- a/e107_handlers/vendor/composer/installed.json +++ b/e107_handlers/vendor/composer/installed.json @@ -1,5 +1,62 @@ { "packages": [ + { + "name": "firebase/php-jwt", + "version": "v5.2.0", + "version_normalized": "5.2.0.0", + "source": { + "type": "git", + "url": "https://github.com/firebase/php-jwt.git", + "reference": "feb0e820b8436873675fd3aca04f3728eb2185cb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/firebase/php-jwt/zipball/feb0e820b8436873675fd3aca04f3728eb2185cb", + "reference": "feb0e820b8436873675fd3aca04f3728eb2185cb", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": ">=4.8 <=9" + }, + "time": "2020-03-25T18:49:23+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Firebase\\JWT\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Neuman Vong", + "email": "neuman+pear@twilio.com", + "role": "Developer" + }, + { + "name": "Anant Narayanan", + "email": "anant@php.net", + "role": "Developer" + } + ], + "description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.", + "homepage": "https://github.com/firebase/php-jwt", + "keywords": [ + "jwt", + "php" + ], + "support": { + "issues": "https://github.com/firebase/php-jwt/issues", + "source": "https://github.com/firebase/php-jwt/tree/master" + }, + "install-path": "../firebase/php-jwt" + }, { "name": "guzzlehttp/psr7", "version": "1.7.0", @@ -80,27 +137,29 @@ }, { "name": "hybridauth/hybridauth", - "version": "3.3.0", - "version_normalized": "3.3.0.0", + "version": "3.6.0", + "version_normalized": "3.6.0.0", "source": { "type": "git", "url": "https://github.com/hybridauth/hybridauth.git", - "reference": "51cb2ad2f04d175d298b51e919868dec1d4d8b04" + "reference": "222ab4e6ee6ffd81caa77283142f3aa97afa5863" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/hybridauth/hybridauth/zipball/51cb2ad2f04d175d298b51e919868dec1d4d8b04", - "reference": "51cb2ad2f04d175d298b51e919868dec1d4d8b04", + "url": "https://api.github.com/repos/hybridauth/hybridauth/zipball/222ab4e6ee6ffd81caa77283142f3aa97afa5863", + "reference": "222ab4e6ee6ffd81caa77283142f3aa97afa5863", "shasum": "" }, "require": { - "php": ">=5.4.0" + "firebase/php-jwt": "*", + "php": ">=5.4.0", + "phpseclib/phpseclib": "~2.0" }, "require-dev": { "ext-curl": "*", "phpunit/phpunit": "^4.8.35 || ^6.5 || ^8" }, - "time": "2020-04-16T08:04:26+00:00", + "time": "2020-10-21T16:32:08+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -124,6 +183,7 @@ "Authentication", "OpenId", "api", + "apple", "authorization", "facebook", "google", @@ -131,6 +191,11 @@ "social", "twitter" ], + "support": { + "gitter": "https://gitter.im/hybridauth/hybridauth", + "issues": "https://github.com/hybridauth/hybridauth/issues", + "source": "https://github.com/hybridauth/hybridauth/tree/3.6.0" + }, "install-path": "../hybridauth/hybridauth" }, { @@ -393,28 +458,32 @@ }, { "name": "phpmailer/phpmailer", - "version": "v6.1.6", - "version_normalized": "6.1.6.0", + "version": "v6.2.0", + "version_normalized": "6.2.0.0", "source": { "type": "git", "url": "https://github.com/PHPMailer/PHPMailer.git", - "reference": "c2796cb1cb99d7717290b48c4e6f32cb6c60b7b3" + "reference": "e38888a75c070304ca5514197d4847a59a5c853f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/c2796cb1cb99d7717290b48c4e6f32cb6c60b7b3", - "reference": "c2796cb1cb99d7717290b48c4e6f32cb6c60b7b3", + "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/e38888a75c070304ca5514197d4847a59a5c853f", + "reference": "e38888a75c070304ca5514197d4847a59a5c853f", "shasum": "" }, "require": { "ext-ctype": "*", "ext-filter": "*", + "ext-hash": "*", "php": ">=5.5.0" }, "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", "doctrine/annotations": "^1.2", - "friendsofphp/php-cs-fixer": "^2.2", - "phpunit/phpunit": "^4.8 || ^5.7" + "phpcompatibility/php-compatibility": "^9.3.5", + "roave/security-advisories": "dev-latest", + "squizlabs/php_codesniffer": "^3.5.6", + "yoast/phpunit-polyfills": "^0.2.0" }, "suggest": { "ext-mbstring": "Needed to send email in multibyte encoding charset", @@ -424,7 +493,7 @@ "stevenmaguire/oauth2-microsoft": "Needed for Microsoft XOAUTH2 authentication", "symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)" }, - "time": "2020-05-27T12:24:03+00:00", + "time": "2020-11-25T15:24:57+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -454,14 +523,130 @@ } ], "description": "PHPMailer is a full-featured email creation and transfer class for PHP", + "support": { + "issues": "https://github.com/PHPMailer/PHPMailer/issues", + "source": "https://github.com/PHPMailer/PHPMailer/tree/v6.2.0" + }, "funding": [ { - "url": "https://github.com/synchro", + "url": "https://github.com/Synchro", "type": "github" } ], "install-path": "../phpmailer/phpmailer" }, + { + "name": "phpseclib/phpseclib", + "version": "2.0.30", + "version_normalized": "2.0.30.0", + "source": { + "type": "git", + "url": "https://github.com/phpseclib/phpseclib.git", + "reference": "136b9ca7eebef78be14abf90d65c5e57b6bc5d36" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/136b9ca7eebef78be14abf90d65c5e57b6bc5d36", + "reference": "136b9ca7eebef78be14abf90d65c5e57b6bc5d36", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phing/phing": "~2.7", + "phpunit/phpunit": "^4.8.35|^5.7|^6.0|^9.4", + "squizlabs/php_codesniffer": "~2.0" + }, + "suggest": { + "ext-gmp": "Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.", + "ext-libsodium": "SSH2/SFTP can make use of some algorithms provided by the libsodium-php extension.", + "ext-mcrypt": "Install the Mcrypt extension in order to speed up a few other cryptographic operations.", + "ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations." + }, + "time": "2020-12-17T05:42:04+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "files": [ + "phpseclib/bootstrap.php" + ], + "psr-4": { + "phpseclib\\": "phpseclib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jim Wigginton", + "email": "terrafrost@php.net", + "role": "Lead Developer" + }, + { + "name": "Patrick Monnerat", + "email": "pm@datasphere.ch", + "role": "Developer" + }, + { + "name": "Andreas Fischer", + "email": "bantu@phpbb.com", + "role": "Developer" + }, + { + "name": "Hans-Jürgen Petrich", + "email": "petrich@tronic-media.com", + "role": "Developer" + }, + { + "name": "Graham Campbell", + "email": "graham@alt-three.com", + "role": "Developer" + } + ], + "description": "PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.", + "homepage": "http://phpseclib.sourceforge.net", + "keywords": [ + "BigInteger", + "aes", + "asn.1", + "asn1", + "blowfish", + "crypto", + "cryptography", + "encryption", + "rsa", + "security", + "sftp", + "signature", + "signing", + "ssh", + "twofish", + "x.509", + "x509" + ], + "support": { + "issues": "https://github.com/phpseclib/phpseclib/issues", + "source": "https://github.com/phpseclib/phpseclib/tree/2.0.30" + }, + "funding": [ + { + "url": "https://github.com/terrafrost", + "type": "github" + }, + { + "url": "https://www.patreon.com/phpseclib", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpseclib/phpseclib", + "type": "tidelift" + } + ], + "install-path": "../phpseclib/phpseclib" + }, { "name": "psr/http-message", "version": "1.0.1", diff --git a/e107_handlers/vendor/composer/installed.php b/e107_handlers/vendor/composer/installed.php index 883ee239d..369ddf72d 100644 --- a/e107_handlers/vendor/composer/installed.php +++ b/e107_handlers/vendor/composer/installed.php @@ -6,7 +6,7 @@ 'aliases' => array ( ), - 'reference' => '1f38b3b3dd231c274f4df1a529883655108b611e', + 'reference' => '153cf33aa76c3378a8332616fe68fd796d00343b', 'name' => 'e107inc/e107', ), 'versions' => @@ -18,7 +18,16 @@ 'aliases' => array ( ), - 'reference' => '1f38b3b3dd231c274f4df1a529883655108b611e', + 'reference' => '153cf33aa76c3378a8332616fe68fd796d00343b', + ), + 'firebase/php-jwt' => + array ( + 'pretty_version' => 'v5.2.0', + 'version' => '5.2.0.0', + 'aliases' => + array ( + ), + 'reference' => 'feb0e820b8436873675fd3aca04f3728eb2185cb', ), 'guzzlehttp/psr7' => array ( @@ -31,12 +40,12 @@ ), 'hybridauth/hybridauth' => array ( - 'pretty_version' => '3.3.0', - 'version' => '3.3.0.0', + 'pretty_version' => '3.6.0', + 'version' => '3.6.0.0', 'aliases' => array ( ), - 'reference' => '51cb2ad2f04d175d298b51e919868dec1d4d8b04', + 'reference' => '222ab4e6ee6ffd81caa77283142f3aa97afa5863', ), 'ifsnop/mysqldump-php' => array ( @@ -76,12 +85,21 @@ ), 'phpmailer/phpmailer' => array ( - 'pretty_version' => 'v6.1.6', - 'version' => '6.1.6.0', + 'pretty_version' => 'v6.2.0', + 'version' => '6.2.0.0', 'aliases' => array ( ), - 'reference' => 'c2796cb1cb99d7717290b48c4e6f32cb6c60b7b3', + 'reference' => 'e38888a75c070304ca5514197d4847a59a5c853f', + ), + 'phpseclib/phpseclib' => + array ( + 'pretty_version' => '2.0.30', + 'version' => '2.0.30.0', + 'aliases' => + array ( + ), + 'reference' => '136b9ca7eebef78be14abf90d65c5e57b6bc5d36', ), 'psr/http-message' => array ( diff --git a/e107_handlers/vendor/hybridauth/hybridauth/CONTRIBUTING.md b/e107_handlers/vendor/hybridauth/hybridauth/CONTRIBUTING.md index 19d2e55e3..ece76a0de 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/CONTRIBUTING.md +++ b/e107_handlers/vendor/hybridauth/hybridauth/CONTRIBUTING.md @@ -1,7 +1,7 @@ Contributing ============ -HybridAuth is a community driven project, and it needs your help to keep the project going. +Hybridauth is a community driven project, and it needs your help to keep the project going. ### Report Problems @@ -30,7 +30,7 @@ Before contributing code, please consider these guide lines: **Coding Style** -HybridAuth follows [PSR-1](http://www.php-fig.org/psr/psr-1/) and [PSR-2](http://www.php-fig.org/psr/psr-2/). +Hybridauth follows [PSR-1](http://www.php-fig.org/psr/psr-1/) and [PSR-2](http://www.php-fig.org/psr/psr-2/). Please prevent your IDE for reformatting huge chunks of code/files as it make it nearly impossible to see what changes were actually made to a file on your Pull Request. @@ -40,7 +40,7 @@ actually made to a file on your Pull Request. Additional providers, minor enhancements, bugs and typos fixes are most welcome. Large and "breaking" changes should be discussed ahead of time. **Please ask first**. -HybridAuth 3 is compatible with **PHP 5.4** and therefore all code supplied must stick to this requirement. +Hybridauth 3 is compatible with **PHP 5.4** and therefore all code supplied must stick to this requirement. **License** diff --git a/e107_handlers/vendor/hybridauth/hybridauth/COPYING.md b/e107_handlers/vendor/hybridauth/hybridauth/COPYING.md index 5086e40a6..6ef806917 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/COPYING.md +++ b/e107_handlers/vendor/hybridauth/hybridauth/COPYING.md @@ -2,7 +2,7 @@ Except where otherwise noted in the source code (i.e., LightOpenID and OAuth Library, which are covered by similar licences but with different Copyright notices) all the files are: - Copyright (C) 2009-2019, HybridAuth authors. All Rights Reserved. + Copyright (C) 2009-2019, Hybridauth authors. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -26,7 +26,7 @@ THE SOFTWARE. ----------------------- -HybridAuth includes a copy of LightOpenID, licensed as follows: +Hybridauth includes a copy of LightOpenID, licensed as follows: Copyright (c) 2013-2016 Mewp (mewp151 at gmail dot com) @@ -52,7 +52,7 @@ THE SOFTWARE. ----------------------- -HybridAuth includes a modified copy of OAuth PHP Library, licensed as follows: +Hybridauth includes a modified copy of OAuth PHP Library, licensed as follows: Copyright (c) 2007-2011 Andy Smith diff --git a/e107_handlers/vendor/hybridauth/hybridauth/README.md b/e107_handlers/vendor/hybridauth/hybridauth/README.md index 1d88c707d..dfa7f403e 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/README.md +++ b/e107_handlers/vendor/hybridauth/hybridauth/README.md @@ -1,4 +1,4 @@ -## [Hybridauth](https://hybridauth.github.io/) 3.3 +## [Hybridauth](https://hybridauth.github.io/) 3.5 [![Build Status](https://travis-ci.org/hybridauth/hybridauth.svg?branch=master)](https://travis-ci.org/hybridauth/hybridauth) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/hybridauth/hybridauth/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/hybridauth/hybridauth/?branch=master) [![Latest Stable Version](https://poser.pugx.org/hybridauth/hybridauth/v/stable.png)](https://packagist.org/packages/hybridauth/hybridauth) [![Join the chat at https://gitter.im/hybridauth/hybridauth](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/hybridauth/hybridauth?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) @@ -13,7 +13,10 @@ Hybridauth provides a number of basic [examples](https://github.com/hybridauth/h ```php $config = [ 'callback' => 'https://example.com/path/to/script.php', - 'keys' => [ 'key' => 'your-twitter-consumer-key', 'secret' => 'your-twitter-consumer-secret' ] + 'keys' => [ + 'key' => 'your-twitter-consumer-key', + 'secret' => 'your-twitter-consumer-secret', + ], ]; try { @@ -46,6 +49,7 @@ To install Hybridauth we recommend [Composer](https://getcomposer.org/), the now |---------|-------------|-------------------------|-------------------------|-------------| | 2.x | Maintenance | [v2][hybridauth-2-repo] | [v2][hybridauth-2-docs] | >= 5.3 | | 3.x | Development | [v3][hybridauth-3-repo] | [v3][hybridauth-3-docs] | >= 5.4 | +| 4.x | Future | -- | -- | >= 7.3 | [hybridauth-2-repo]: https://github.com/hybridauth/hybridauth/tree/v2 [hybridauth-3-repo]: https://github.com/hybridauth/hybridauth/ diff --git a/e107_handlers/vendor/hybridauth/hybridauth/examples/README.md b/e107_handlers/vendor/hybridauth/hybridauth/examples/README.md deleted file mode 100644 index af9022d79..000000000 --- a/e107_handlers/vendor/hybridauth/hybridauth/examples/README.md +++ /dev/null @@ -1,12 +0,0 @@ -Hybridauth 3 Examples -====================== - -File | Description --------------- | ------------------------------------------------------------------------------ -example_01.php | This simple example illustrate how to authenticate users with GitHub. If you're new to Hybridauth, this file is the one you'll likely want to check. -example_02.php | Details how to use users in a similar fashion to Hybridauth 2. Note that while Hybridauth 3 provides a similar interface to Hybridauth 2, both versions are not fully compatible with each other. -example_03.php | An example on how use Access Tokens to access providers APIs, and how to setup custom API endpoints. -example_04.php | A simple example that shows how to connect users to providers using OpenID. -example_05.php | A simple example that shows how to use Guzzle as a Http Client for Hybridauth instead of PHP Curl extension. -example_06/ | A simple example that shows how to organize multiple providers. -example_07/ | A simple example that shows how to organize multiple providers, using a pop-up. diff --git a/e107_handlers/vendor/hybridauth/hybridauth/examples/example_01.php b/e107_handlers/vendor/hybridauth/hybridauth/examples/example_01.php deleted file mode 100644 index c8bbb6843..000000000 --- a/e107_handlers/vendor/hybridauth/hybridauth/examples/example_01.php +++ /dev/null @@ -1,190 +0,0 @@ - Hybridauth\HttpClient\Util::getCurrentUrl() - * - * After configuring your GitHub application, simple replace 'your-app-id' and 'your-app-secret' - * with your application credentials (Client ID and Client Secret). - * - * Providers who uses OAuth 2.0 protocol (i.g., GitHub, Facebook, Google, etc.) may need - * an Authorization scope as additional parameter. Authorization scopes are strings that - * enable access to particular resources, such as user data. - * - * https://developer.github.com/v3/oauth/ - * https://developer.github.com/v3/oauth/#scopes - */ - -$config = [ - 'callback' => 'https://path/to/hybridauth/examples/example_01.php', // or Hybridauth\HttpClient\Util::getCurrentUrl() - - 'keys' => [ 'id' => 'your-app-id', 'secret' => 'your-app-secret' ], // Your Github application credentials - - /* optional : set scope - 'scope' => 'user:email', */ - - /* optional : set debug mode - 'debug_mode' => true, - // Path to file writeable by the web server. Required if 'debug_mode' is not false - 'debug_file' => __FILE__ . '.log', */ - - /* optional : customize Curl settings - // for more information on curl, refer to: http://www.php.net/manual/fr/function.curl-setopt.php - 'curl_options' => [ - // setting custom certificates - CURLOPT_SSL_VERIFYPEER => true, - CURLOPT_CAINFO => '/path/to/your/certificate.crt', - - // set a valid proxy ip address - CURLOPT_PROXY => '*.*.*.*:*', - - // set a custom user agent - CURLOPT_USERAGENT => '' - ] */ -]; - -/** - * Step 3: Instantiate Github Adapter - * - * This example instantiates a GitHub adapter using the array $config we just built. - */ - -$github = new Hybridauth\Provider\GitHub($config); - -/** - * Step 4: Authenticating Users - * - * When invoked, `authenticate()` will redirect users to GitHub login page where they - * will be asked to grant access to your application. If they do, GitHub will redirect - * the users back to Authorization callback URL (i.e., this script). - * - * Note that GitHub and few other providers will ask their users for authorisation - * only once. - */ - -$github->authenticate(); - -/** - * Step 5: Retrieve Users Profiles - * - * Calling getUserProfile returns an instance of class Hybridauth\User\Profile which contain the - * connected user's profile in simple and standardized structure across all the social APIs supported - * by HybridAuth. - */ - -$userProfile = $github->getUserProfile(); - -echo 'Hi '.$userProfile->displayName; - -/** - * Bonus: Access GitHub API - * - * Now that the user is authenticated with Gihub, and depending on the authorization given to your - * application, you should be able to query the said API on behalf of the user. - * - * As an example we list the authenticated user's public gists. - */ - -$apiResponse = $github->apiRequest('gists'); - -/** - * Step 6: Disconnect the adapter - * - * This will erase the current user authentication data from session, and any further - * attempt to communicate with Github API will result on an authorisation exception. - */ - -$github->disconnect(); - -/** - * Final note: Catching Exceptions - * - * Hybridauth use exceptions extensively and it's important that these exceptions - * be properly caught/handled in your code. - * - * Below is a basic example of how to catch exceptions. - * - * Note that on the previous step we disconnected from the API; meaning Hybridauth - * has erased the oauth access token used to sign http requests from the current - * session, thus, any new request we now make will now throw an exception. - * - * It's important that you don't show Hybridauth exception's messages to the end user as - * they may include sensitive data, and that you use your own error messages instead. - */ - -try { - $github->getUserProfile(); -} - -/** - * Catch Curl Errors - * - * This kind of error may happen in case of: - * - Internet or Network issues. - * - Your server configuration is not setup correctly. - * - * The full list of curl errors that may happen can be found at http://curl.haxx.se/libcurl/c/libcurl-errors.html - */ - -catch (Hybridauth\Exception\HttpClientFailureException $e) { - echo 'Curl text error message : '.$github->getHttpClient()->getResponseClientError(); -} - -/** - * Catch API Requests Errors - * - * This usually happens when requesting a: - * - Wrong URI or a mal-formatted http request. - * - Protected resource without providing a valid access token. - */ - -catch (Hybridauth\Exception\HttpRequestFailedException $e) { - echo 'Raw API Response: '.$github->getHttpClient()->getResponseBody(); -} - -/** - * Base PHP's exception that catches everything [else] - */ - -catch (\Exception $e) { - echo 'Oops! We ran into an unknown issue: '.$e->getMessage(); -} diff --git a/e107_handlers/vendor/hybridauth/hybridauth/examples/example_02.php b/e107_handlers/vendor/hybridauth/hybridauth/examples/example_02.php deleted file mode 100644 index 206fb496d..000000000 --- a/e107_handlers/vendor/hybridauth/hybridauth/examples/example_02.php +++ /dev/null @@ -1,76 +0,0 @@ - HttpClient\Util::getCurrentUrl(), - - 'providers' => [ - 'GitHub' => [ - 'enabled' => true, - 'keys' => [ 'id' => '', 'secret' => '' ], - ], - - 'Google' => [ - 'enabled' => true, - 'keys' => [ 'id' => '', 'secret' => '' ], - ], - - 'Facebook' => [ - 'enabled' => true, - 'keys' => [ 'id' => '', 'secret' => '' ], - ], - - 'Twitter' => [ - 'enabled' => true, - 'keys' => [ 'key' => '', 'secret' => '' ], - ] - ], - - /* optional : set debug mode - 'debug_mode' => true, - // Path to file writeable by the web server. Required if 'debug_mode' is not false - 'debug_file' => __FILE__ . '.log', */ - - /* optional : customize Curl settings - // for more information on curl, refer to: http://www.php.net/manual/fr/function.curl-setopt.php - 'curl_options' => [ - // setting custom certificates - CURLOPT_SSL_VERIFYPEER => true, - CURLOPT_CAINFO => '/path/to/your/certificate.crt', - - // set a valid proxy ip address - CURLOPT_PROXY => '*.*.*.*:*', - - // set a custom user agent - CURLOPT_USERAGENT => '' - ] */ -]; - -try { - $hybridauth = new Hybridauth( $config ); - - $adapter = $hybridauth->authenticate( 'GitHub' ); - - // $adapter = $hybridauth->authenticate( 'Google' ); - // $adapter = $hybridauth->authenticate( 'Facebook' ); - // $adapter = $hybridauth->authenticate( 'Twitter' ); - - $tokens = $adapter->getAccessToken(); - $userProfile = $adapter->getUserProfile(); - - // print_r( $tokens ); - // print_r( $userProfile ); - - $adapter->disconnect(); -} -catch (\Exception $e) { - echo $e->getMessage(); -} diff --git a/e107_handlers/vendor/hybridauth/hybridauth/examples/example_03.php b/e107_handlers/vendor/hybridauth/hybridauth/examples/example_03.php deleted file mode 100644 index 390b2a821..000000000 --- a/e107_handlers/vendor/hybridauth/hybridauth/examples/example_03.php +++ /dev/null @@ -1,33 +0,0 @@ - Hybridauth\HttpClient\Util::getCurrentUrl(), - - 'keys' => [ 'id' => 'your-facebook-app-id', 'secret' => 'your-facebook-app-secret' ], - - 'endpoints' => [ - 'api_base_url' => 'https://graph.facebook.com/v2.8/', - 'authorize_url' => 'https://www.facebook.com/dialog/oauth', - 'access_token_url' => 'https://graph.facebook.com/oauth/access_token', - ] -]; - -try { - $adapter = new Hybridauth\Provider\Facebook( $config ); - - $adapter->setAccessToken(['access_token' => 'user-facebook-access-token']); - - $userProfile = $adapter->getUserProfile(); - - // print_r( $userProfile ); - - $adapter->disconnect(); -} -catch( Exception $e ){ - echo $e->getMessage(); -} diff --git a/e107_handlers/vendor/hybridauth/hybridauth/examples/example_04.php b/e107_handlers/vendor/hybridauth/hybridauth/examples/example_04.php deleted file mode 100644 index d57868295..000000000 --- a/e107_handlers/vendor/hybridauth/hybridauth/examples/example_04.php +++ /dev/null @@ -1,32 +0,0 @@ - Hybridauth\HttpClient\Util::getCurrentUrl(), - - 'openid_identifier' => 'https://open.login.yahooapis.com/openid20/www.yahoo.com/xrds', - // 'openid_identifier' => 'https://openid.stackexchange.com/', - // 'openid_identifier' => 'http://steamcommunity.com/openid', - // etc. -]; - -try { - $adapter = new Hybridauth\Provider\OpenID( $config ); - - $adapter->authenticate(); - - $tokens = $adapter->getAccessToken(); - $userProfile = $adapter->getUserProfile(); - - // print_r( $tokens ); - // print_r( $userProfile ); - - $adapter->disconnect(); -} -catch( Exception $e ){ - echo $e->getMessage(); -} diff --git a/e107_handlers/vendor/hybridauth/hybridauth/examples/example_05.php b/e107_handlers/vendor/hybridauth/hybridauth/examples/example_05.php deleted file mode 100644 index 4c8535ede..000000000 --- a/e107_handlers/vendor/hybridauth/hybridauth/examples/example_05.php +++ /dev/null @@ -1,33 +0,0 @@ - Hybridauth\HttpClient\Util::getCurrentUrl(), - - 'keys' => [ 'id' => '', 'secret' => '' ], -]; - -$guzzle = new Hybridauth\HttpClient\Guzzle(null, [ - // 'verify' => true, # Set to false to disable SSL certificate verification -]); - -try { - $adapter = new Hybridauth\Provider\Github($config, $guzzle); - - $adapter->authenticate(); - - $tokens = $adapter->getAccessToken(); - $userProfile = $adapter->getUserProfile(); - - // print_r( $tokens ); - // print_r( $userProfile ); - - $adapter->disconnect(); -} -catch( Exception $e ){ - echo $e->getMessage(); -} diff --git a/e107_handlers/vendor/hybridauth/hybridauth/examples/example_06/callback.php b/e107_handlers/vendor/hybridauth/hybridauth/examples/example_06/callback.php deleted file mode 100644 index b8768ba4c..000000000 --- a/e107_handlers/vendor/hybridauth/hybridauth/examples/example_06/callback.php +++ /dev/null @@ -1,59 +0,0 @@ -set('provider', $_GET['provider']); - } - - /** - * When provider exists in the storage, try to authenticate user and clear storage. - * - * When invoked, `authenticate()` will redirect users to provider login page where they - * will be asked to grant access to your application. If they do, provider will redirect - * the users back to Authorization callback URL (i.e., this script). - */ - if ($provider = $storage->get('provider')) { - $hybridauth->authenticate($provider); - $storage->set('provider', null); - } - - /** - * This will erase the current user authentication data from session, and any further - * attempt to communicate with provider. - */ - if (isset($_GET['logout'])) { - $adapter = $hybridauth->getAdapter($_GET['logout']); - $adapter->disconnect(); - } - - /** - * Redirects user to home page (i.e., index.php in our case) - */ - HttpClient\Util::redirect('https://path/to/hybridauth/examples/example_06'); -} catch (Exception $e) { - echo $e->getMessage(); -} diff --git a/e107_handlers/vendor/hybridauth/hybridauth/examples/example_06/config.php b/e107_handlers/vendor/hybridauth/hybridauth/examples/example_06/config.php deleted file mode 100644 index 4fe6235f6..000000000 --- a/e107_handlers/vendor/hybridauth/hybridauth/examples/example_06/config.php +++ /dev/null @@ -1,35 +0,0 @@ - 'https://path/to/hybridauth/examples/example_06/callback.php', - 'providers' => [ - 'Twitter' => [ - 'enabled' => true, - 'keys' => [ - 'key' => '...', - 'secret' => '...', - ], - ], - 'LinkedIn' => [ - 'enabled' => true, - 'keys' => [ - 'id' => '...', - 'secret' => '...', - ], - ], - 'Facebook' => [ - 'enabled' => true, - 'keys' => [ - 'id' => '...', - 'secret' => '...', - ], - ], - ], -]; diff --git a/e107_handlers/vendor/hybridauth/hybridauth/examples/example_06/index.php b/e107_handlers/vendor/hybridauth/hybridauth/examples/example_06/index.php deleted file mode 100644 index 4d5ec484e..000000000 --- a/e107_handlers/vendor/hybridauth/hybridauth/examples/example_06/index.php +++ /dev/null @@ -1,49 +0,0 @@ -getConnectedAdapters(); -?> - - - - - - Example 06 - - -

Sign in

- - - - -

You are logged in:

- - - - diff --git a/e107_handlers/vendor/hybridauth/hybridauth/examples/example_07/callback.php b/e107_handlers/vendor/hybridauth/hybridauth/examples/example_07/callback.php deleted file mode 100644 index 165fb7af4..000000000 --- a/e107_handlers/vendor/hybridauth/hybridauth/examples/example_07/callback.php +++ /dev/null @@ -1,97 +0,0 @@ -getProviders())) { - // Store the provider for the callback event - $storage->set('provider', $_GET['provider']); - } else { - $error = $_GET['provider']; - } - } - - // - // Event 2: User clicked LOGOUT link - // - if (isset($_GET['logout'])) { - if (in_array($_GET['logout'], $hybridauth->getProviders())) { - // Disconnect the adapter - $adapter = $hybridauth->getAdapter($_GET['logout']); - $adapter->disconnect(); - } else { - $error = $_GET['logout']; - } - } - - // - // Handle invalid provider errors - // - if ($error) { - error_log('HybridAuth Error: Provider '. json_encode($error) .' not found or not enabled in $config'); - // Close the pop-up window - echo " - "; - exit; - } - - // - // Event 3: Provider returns via CALLBACK - // - if ($provider = $storage->get('provider')) { - - $hybridauth->authenticate($provider); - $storage->set('provider', null); - - // Retrieve the provider record - $adapter = $hybridauth->getAdapter($provider); - $userProfile = $adapter->getUserProfile(); - $accessToken = $adapter->getAccessToken(); - - // add your custom AUTH functions (if any) here - // ... - $data = [ - 'token' => $accessToken, - 'identifier' => $userProfile->identifier, - 'email' => $userProfile->email, - 'first_name' => $userProfile->firstName, - 'last_name' => $userProfile->lastName, - 'photoURL' => strtok($userProfile->photoURL,'?'), - ]; - // ... - - // Close pop-up window - echo " - "; - - } - -} catch (Exception $e) { - error_log( $e->getMessage()); - echo $e->getMessage(); -} diff --git a/e107_handlers/vendor/hybridauth/hybridauth/examples/example_07/config.php b/e107_handlers/vendor/hybridauth/hybridauth/examples/example_07/config.php deleted file mode 100644 index 224680db2..000000000 --- a/e107_handlers/vendor/hybridauth/hybridauth/examples/example_07/config.php +++ /dev/null @@ -1,27 +0,0 @@ - 'https://path/to/hybridauth/examples/example_07/callback.php', - 'providers' => [ - - 'Google' => [ - 'enabled' => true, - 'keys' => [ - 'id' => '...', - 'secret' => '...', - ], - 'scope' => 'email', - ], - - // 'Yahoo' => ['enabled' => true, 'keys' => [ 'key' => '...', 'secret' => '...']], - // 'Facebook' => ['enabled' => true, 'keys' => [ 'id' => '...', 'secret' => '...']], - // 'Twitter' => ['enabled' => true, 'keys' => [ 'key' => '...', 'secret' => '...']], - // 'Instagram' => ['enabled' => true, 'keys' => [ 'id' => '...', 'secret' => '...']], - - ], -]; diff --git a/e107_handlers/vendor/hybridauth/hybridauth/examples/example_07/index.php b/e107_handlers/vendor/hybridauth/hybridauth/examples/example_07/index.php deleted file mode 100644 index cabd02132..000000000 --- a/e107_handlers/vendor/hybridauth/hybridauth/examples/example_07/index.php +++ /dev/null @@ -1,61 +0,0 @@ -getConnectedAdapters(); -?> - - - - - - Example 07 - - - - - -

Sign in

- - - - -

You are logged in:

- - - - - diff --git a/e107_handlers/vendor/hybridauth/hybridauth/examples/index.html b/e107_handlers/vendor/hybridauth/hybridauth/examples/index.html deleted file mode 100644 index ddcc351ae..000000000 --- a/e107_handlers/vendor/hybridauth/hybridauth/examples/index.html +++ /dev/null @@ -1 +0,0 @@ -403. \ No newline at end of file diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Adapter/AbstractAdapter.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Adapter/AbstractAdapter.php index 9ee76a76a..0066d8496 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Adapter/AbstractAdapter.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Adapter/AbstractAdapter.php @@ -78,23 +78,23 @@ abstract class AbstractAdapter implements AdapterInterface /** * Whether to validate API status codes of http responses * - * @var boolean + * @var bool */ protected $validateApiResponseHttpCode = true; /** * Common adapters constructor. * - * @param array $config + * @param array $config * @param HttpClientInterface $httpClient - * @param StorageInterface $storage - * @param LoggerInterface $logger + * @param StorageInterface $storage + * @param LoggerInterface $logger */ public function __construct( $config = [], HttpClientInterface $httpClient = null, - StorageInterface $storage = null, - LoggerInterface $logger = null + StorageInterface $storage = null, + LoggerInterface $logger = null ) { $this->providerId = (new \ReflectionClass($this))->getShortName(); @@ -114,15 +114,20 @@ abstract class AbstractAdapter implements AdapterInterface } /** - * Load adapter's configuration - */ + * Load adapter's configuration + */ abstract protected function configure(); /** - * Adapter initializer - */ + * Adapter initializer + */ abstract protected function initialize(); + /** + * {@inheritdoc} + */ + abstract public function isConnected(); + /** * {@inheritdoc} */ @@ -179,16 +184,6 @@ abstract class AbstractAdapter implements AdapterInterface throw new NotImplementedException('Provider does not support this feature.'); } - /** - * {@inheritdoc} - * - * Checking access_token only works for oauth1 and oauth2, openid will overwrite this method. - */ - public function isConnected() - { - return (bool) $this->getStoredData('access_token'); - } - /** * {@inheritdoc} */ @@ -215,7 +210,7 @@ abstract class AbstractAdapter implements AdapterInterface foreach ($tokenNames as $name) { if ($this->getStoredData($name)) { - $tokens[ $name ] = $this->getStoredData($name); + $tokens[$name] = $this->getStoredData($name); } } @@ -297,15 +292,15 @@ abstract class AbstractAdapter implements AdapterInterface } /** - * Set Adapter's API callback url - * - * @param string $callback - * - * @throws InvalidArgumentException - */ + * Set Adapter's API callback url + * + * @param string $callback + * + * @throws InvalidArgumentException + */ protected function setCallback($callback) { - if (! filter_var($callback, FILTER_VALIDATE_URL)) { + if (!filter_var($callback, FILTER_VALIDATE_URL)) { throw new InvalidArgumentException('A valid callback url is required.'); } @@ -348,12 +343,12 @@ abstract class AbstractAdapter implements AdapterInterface if ($this->httpClient->getResponseClientError()) { throw new HttpClientFailureException( - $error.'HTTP client error: '.$this->httpClient->getResponseClientError().'.' + $error . 'HTTP client error: ' . $this->httpClient->getResponseClientError() . '.' ); } // if validateApiResponseHttpCode is set to false, we by pass verification of http status code - if (! $this->validateApiResponseHttpCode) { + if (!$this->validateApiResponseHttpCode) { return; } @@ -361,8 +356,8 @@ abstract class AbstractAdapter implements AdapterInterface if ($status < 200 || $status > 299) { throw new HttpRequestFailedException( - $error . 'HTTP error '.$this->httpClient->getResponseHttpCode(). - '. Raw Provider API response: '.$this->httpClient->getResponseBody().'.' + $error . 'HTTP error ' . $this->httpClient->getResponseHttpCode() . + '. Raw Provider API response: ' . $this->httpClient->getResponseBody() . '.' ); } } diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Adapter/AdapterInterface.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Adapter/AdapterInterface.php index ef8beda05..c2577d288 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Adapter/AdapterInterface.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Adapter/AdapterInterface.php @@ -19,14 +19,14 @@ interface AdapterInterface /** * Initiate the appropriate protocol and process/automate the authentication or authorization flow. * - * @return boolean|null + * @return bool|null */ public function authenticate(); /** * Returns TRUE if the user is connected * - * @return boolean + * @return bool */ public function isConnected(); diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Adapter/DataStoreTrait.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Adapter/DataStoreTrait.php index 8268349ec..13498a570 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Adapter/DataStoreTrait.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Adapter/DataStoreTrait.php @@ -26,7 +26,7 @@ trait DataStoreTrait * can be also used by providers to store any other useful data (i.g., user_id, auth_nonce, etc.) * * @param string $name - * @param mixed $value + * @param mixed $value */ protected function storeData($name, $value = null) { @@ -35,7 +35,7 @@ trait DataStoreTrait $this->deleteStoredData($name); } - $this->getStorage()->set($this->providerId.'.'.$name, $value); + $this->getStorage()->set($this->providerId . '.' . $name, $value); } /** @@ -51,7 +51,7 @@ trait DataStoreTrait */ protected function getStoredData($name) { - return $this->getStorage()->get($this->providerId.'.'.$name); + return $this->getStorage()->get($this->providerId . '.' . $name); } /** @@ -61,7 +61,7 @@ trait DataStoreTrait */ protected function deleteStoredData($name) { - $this->getStorage()->delete($this->providerId.'.'.$name); + $this->getStorage()->delete($this->providerId . '.' . $name); } /** @@ -69,6 +69,6 @@ trait DataStoreTrait */ protected function clearStoredData() { - $this->getStorage()->deleteMatch($this->providerId.'.'); + $this->getStorage()->deleteMatch($this->providerId . '.'); } } diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Adapter/OAuth1.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Adapter/OAuth1.php index 2ae5036cf..c59005cb1 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Adapter/OAuth1.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Adapter/OAuth1.php @@ -28,129 +28,129 @@ use Hybridauth\Thirdparty\OAuth\OAuthUtil; abstract class OAuth1 extends AbstractAdapter implements AdapterInterface { /** - * Base URL to provider API - * - * This var will be used to build urls when sending signed requests - * - * @var string - */ + * Base URL to provider API + * + * This var will be used to build urls when sending signed requests + * + * @var string + */ protected $apiBaseUrl = ''; /** - * @var string - */ + * @var string + */ protected $authorizeUrl = ''; /** - * @var string - */ + * @var string + */ protected $requestTokenUrl = ''; /** - * @var string - */ + * @var string + */ protected $accessTokenUrl = ''; /** - * IPD API Documentation - * - * OPTIONAL. - * - * @var string - */ + * IPD API Documentation + * + * OPTIONAL. + * + * @var string + */ protected $apiDocumentation = ''; /** - * OAuth Version - * - * '1.0' OAuth Core 1.0 - * '1.0a' OAuth Core 1.0 Revision A - * - * @var string - */ + * OAuth Version + * + * '1.0' OAuth Core 1.0 + * '1.0a' OAuth Core 1.0 Revision A + * + * @var string + */ protected $oauth1Version = '1.0a'; /** - * @var string - */ + * @var string + */ protected $consumerKey = null; /** - * @var string - */ + * @var string + */ protected $consumerSecret = null; /** - * @var object - */ + * @var object + */ protected $OAuthConsumer = null; /** - * @var object - */ + * @var object + */ protected $sha1Method = null; /** - * @var object - */ + * @var object + */ protected $consumerToken = null; /** - * Authorization Url Parameters - * - * @var boolean - */ + * Authorization Url Parameters + * + * @var bool + */ protected $AuthorizeUrlParameters = []; /** - * @var string - */ + * @var string + */ protected $requestTokenMethod = 'POST'; /** - * @var array - */ + * @var array + */ protected $requestTokenParameters = []; /** - * @var array - */ + * @var array + */ protected $requestTokenHeaders = []; /** - * @var string - */ + * @var string + */ protected $tokenExchangeMethod = 'POST'; /** - * @var array - */ + * @var array + */ protected $tokenExchangeParameters = []; /** - * @var array - */ + * @var array + */ protected $tokenExchangeHeaders = []; /** - * @var array - */ + * @var array + */ protected $apiRequestParameters = []; /** - * @var array - */ + * @var array + */ protected $apiRequestHeaders = []; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected function configure() { - $this->consumerKey = $this->config->filter('keys')->get('id') ?: $this->config->filter('keys')->get('key'); + $this->consumerKey = $this->config->filter('keys')->get('id') ?: $this->config->filter('keys')->get('key'); $this->consumerSecret = $this->config->filter('keys')->get('secret'); - if (! $this->consumerKey || !$this->consumerSecret) { + if (!$this->consumerKey || !$this->consumerSecret) { throw new InvalidApplicationCredentialsException( 'Your application id is required in order to connect to ' . $this->providerId ); @@ -165,23 +165,23 @@ abstract class OAuth1 extends AbstractAdapter implements AdapterInterface } /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected function initialize() { /** - * Set up OAuth Signature and Consumer - * - * OAuth Core: All Token requests and Protected Resources requests MUST be signed - * by the Consumer and verified by the Service Provider. - * - * The protocol defines three signature methods: HMAC-SHA1, RSA-SHA1, and PLAINTEXT.. - * - * The Consumer declares a signature method in the oauth_signature_method parameter.. - * - * http://oauth.net/core/1.0a/#signing_process - */ - $this->sha1Method = new OAuthSignatureMethodHMACSHA1(); + * Set up OAuth Signature and Consumer + * + * OAuth Core: All Token requests and Protected Resources requests MUST be signed + * by the Consumer and verified by the Service Provider. + * + * The protocol defines three signature methods: HMAC-SHA1, RSA-SHA1, and PLAINTEXT.. + * + * The Consumer declares a signature method in the oauth_signature_method parameter.. + * + * http://oauth.net/core/1.0a/#signing_process + */ + $this->sha1Method = new OAuthSignatureMethodHMACSHA1(); $this->OAuthConsumer = new OAuthConsumer( $this->consumerKey, @@ -204,8 +204,8 @@ abstract class OAuth1 extends AbstractAdapter implements AdapterInterface } /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function authenticate() { $this->logger->info(sprintf('%s::authenticate()', get_class($this))); @@ -215,9 +215,14 @@ abstract class OAuth1 extends AbstractAdapter implements AdapterInterface } try { - if (! $this->getStoredData('request_token')) { + if (!$this->getStoredData('request_token')) { + // Start a new flow. $this->authenticateBegin(); - } elseif (! $this->getStoredData('access_token')) { + } elseif (empty($_GET['oauth_token']) && empty($_GET['denied'])) { + // A previous authentication was not finished, and this request is not finishing it. + $this->authenticateBegin(); + } else { + // Finish a flow. $this->authenticateFinish(); } } catch (Exception $exception) { @@ -230,12 +235,20 @@ abstract class OAuth1 extends AbstractAdapter implements AdapterInterface } /** - * Initiate the authorization protocol - * - * 1. Obtaining an Unauthorized Request Token - * 2. Build Authorization URL for Authorization Request and redirect the user-agent to the - * Authorization Server. - */ + * {@inheritdoc} + */ + public function isConnected() + { + return (bool)$this->getStoredData('access_token'); + } + + /** + * Initiate the authorization protocol + * + * 1. Obtaining an Unauthorized Request Token + * 2. Build Authorization URL for Authorization Request and redirect the user-agent to the + * Authorization Server. + */ protected function authenticateBegin() { $response = $this->requestAuthToken(); @@ -265,9 +278,9 @@ abstract class OAuth1 extends AbstractAdapter implements AdapterInterface [HttpClient\Util::getCurrentUrl(true)] ); - $denied = filter_input(INPUT_GET, 'denied'); - $oauth_problem = filter_input(INPUT_GET, 'oauth_problem'); - $oauth_token = filter_input(INPUT_GET, 'oauth_token'); + $denied = filter_input(INPUT_GET, 'denied'); + $oauth_problem = filter_input(INPUT_GET, 'oauth_problem'); + $oauth_token = filter_input(INPUT_GET, 'oauth_token'); $oauth_verifier = filter_input(INPUT_GET, 'oauth_verifier'); if ($denied) { @@ -278,11 +291,11 @@ abstract class OAuth1 extends AbstractAdapter implements AdapterInterface if ($oauth_problem) { throw new InvalidOauthTokenException( - 'Provider returned an invalid oauth_token. oauth_problem: ' . htmlentities($oauth_problem) + 'Provider returned an error. oauth_problem: ' . htmlentities($oauth_problem) ); } - if (! $oauth_token) { + if (!$oauth_token) { throw new InvalidOauthTokenException( 'Expecting a non-null oauth_token to continue the authorization flow.' ); @@ -296,20 +309,20 @@ abstract class OAuth1 extends AbstractAdapter implements AdapterInterface } /** - * Build Authorization URL for Authorization Request - * - * @param array $parameters - * - * @return string - */ + * Build Authorization URL for Authorization Request + * + * @param array $parameters + * + * @return string + */ protected function getAuthorizeUrl($parameters = []) { $this->AuthorizeUrlParameters = !empty($parameters) - ? $parameters - : array_replace( - (array) $this->AuthorizeUrlParameters, - (array) $this->config->get('authorize_url_parameters') - ); + ? $parameters + : array_replace( + (array)$this->AuthorizeUrlParameters, + (array)$this->config->get('authorize_url_parameters') + ); $this->AuthorizeUrlParameters['oauth_token'] = $this->getStoredData('request_token'); @@ -317,27 +330,27 @@ abstract class OAuth1 extends AbstractAdapter implements AdapterInterface } /** - * Unauthorized Request Token - * - * OAuth Core: The Consumer obtains an unauthorized Request Token by asking the Service Provider - * to issue a Token. The Request Token's sole purpose is to receive User approval and can only - * be used to obtain an Access Token. - * - * http://oauth.net/core/1.0/#auth_step1 - * 6.1.1. Consumer Obtains a Request Token - * - * @return string Raw Provider API response - * @throws \Hybridauth\Exception\HttpClientFailureException - * @throws \Hybridauth\Exception\HttpRequestFailedException - */ + * Unauthorized Request Token + * + * OAuth Core: The Consumer obtains an unauthorized Request Token by asking the Service Provider + * to issue a Token. The Request Token's sole purpose is to receive User approval and can only + * be used to obtain an Access Token. + * + * http://oauth.net/core/1.0/#auth_step1 + * 6.1.1. Consumer Obtains a Request Token + * + * @return string Raw Provider API response + * @throws \Hybridauth\Exception\HttpClientFailureException + * @throws \Hybridauth\Exception\HttpRequestFailedException + */ protected function requestAuthToken() { /** - * OAuth Core 1.0 Revision A: oauth_callback: An absolute URL to which the Service Provider will redirect - * the User back when the Obtaining User Authorization step is completed. - * - * http://oauth.net/core/1.0a/#auth_step1 - */ + * OAuth Core 1.0 Revision A: oauth_callback: An absolute URL to which the Service Provider will redirect + * the User back when the Obtaining User Authorization step is completed. + * + * http://oauth.net/core/1.0a/#auth_step1 + */ if ('1.0a' == $this->oauth1Version) { $this->requestTokenParameters['oauth_callback'] = $this->callback; } @@ -353,51 +366,51 @@ abstract class OAuth1 extends AbstractAdapter implements AdapterInterface } /** - * Validate Unauthorized Request Token Response - * - * OAuth Core: The Service Provider verifies the signature and Consumer Key. If successful, - * it generates a Request Token and Token Secret and returns them to the Consumer in the HTTP - * response body. - * - * http://oauth.net/core/1.0/#auth_step1 - * 6.1.2. Service Provider Issues an Unauthorized Request Token - * - * @param string $response - * - * @return \Hybridauth\Data\Collection - * @throws InvalidOauthTokenException - */ + * Validate Unauthorized Request Token Response + * + * OAuth Core: The Service Provider verifies the signature and Consumer Key. If successful, + * it generates a Request Token and Token Secret and returns them to the Consumer in the HTTP + * response body. + * + * http://oauth.net/core/1.0/#auth_step1 + * 6.1.2. Service Provider Issues an Unauthorized Request Token + * + * @param string $response + * + * @return \Hybridauth\Data\Collection + * @throws InvalidOauthTokenException + */ protected function validateAuthTokenRequest($response) { /** - * The response contains the following parameters: - * - * - oauth_token The Request Token. - * - oauth_token_secret The Token Secret. - * - oauth_callback_confirmed MUST be present and set to true. - * - * http://oauth.net/core/1.0/#auth_step1 - * 6.1.2. Service Provider Issues an Unauthorized Request Token - * - * Example of a successful response: - * - * HTTP/1.1 200 OK - * Content-Type: text/html; charset=utf-8 - * Cache-Control: no-store - * Pragma: no-cache - * - * oauth_token=80359084-clg1DEtxQF3wstTcyUdHF3wsdHM&oauth_token_secret=OIF07hPmJB:P - * 6qiHTi1znz6qiH3tTcyUdHnz6qiH3tTcyUdH3xW3wsDvV08e&example_parameter=example_value - * - * OAuthUtil::parse_parameters will attempt to decode the raw response into an array. - */ + * The response contains the following parameters: + * + * - oauth_token The Request Token. + * - oauth_token_secret The Token Secret. + * - oauth_callback_confirmed MUST be present and set to true. + * + * http://oauth.net/core/1.0/#auth_step1 + * 6.1.2. Service Provider Issues an Unauthorized Request Token + * + * Example of a successful response: + * + * HTTP/1.1 200 OK + * Content-Type: text/html; charset=utf-8 + * Cache-Control: no-store + * Pragma: no-cache + * + * oauth_token=80359084-clg1DEtxQF3wstTcyUdHF3wsdHM&oauth_token_secret=OIF07hPmJB:P + * 6qiHTi1znz6qiH3tTcyUdHnz6qiH3tTcyUdH3xW3wsDvV08e&example_parameter=example_value + * + * OAuthUtil::parse_parameters will attempt to decode the raw response into an array. + */ $tokens = OAuthUtil::parse_parameters($response); $collection = new Data\Collection($tokens); - if (! $collection->exists('oauth_token')) { + if (!$collection->exists('oauth_token')) { throw new InvalidOauthTokenException( - 'Provider returned an invalid access_token: ' . htmlentities($response) + 'Provider returned no oauth_token: ' . htmlentities($response) ); } @@ -413,30 +426,30 @@ abstract class OAuth1 extends AbstractAdapter implements AdapterInterface } /** - * Requests an Access Token - * - * OAuth Core: The Request Token and Token Secret MUST be exchanged for an Access Token and Token Secret. - * - * http://oauth.net/core/1.0a/#auth_step3 - * 6.3.1. Consumer Requests an Access Token - * - * @param string $oauth_token - * @param string $oauth_verifier - * - * @return string Raw Provider API response - * @throws \Hybridauth\Exception\HttpClientFailureException - * @throws \Hybridauth\Exception\HttpRequestFailedException - */ + * Requests an Access Token + * + * OAuth Core: The Request Token and Token Secret MUST be exchanged for an Access Token and Token Secret. + * + * http://oauth.net/core/1.0a/#auth_step3 + * 6.3.1. Consumer Requests an Access Token + * + * @param string $oauth_token + * @param string $oauth_verifier + * + * @return string Raw Provider API response + * @throws \Hybridauth\Exception\HttpClientFailureException + * @throws \Hybridauth\Exception\HttpRequestFailedException + */ protected function exchangeAuthTokenForAccessToken($oauth_token, $oauth_verifier = '') { $this->tokenExchangeParameters['oauth_token'] = $oauth_token; /** - * OAuth Core 1.0 Revision A: oauth_verifier: The verification code received from the Service Provider - * in the "Service Provider Directs the User Back to the Consumer" step. - * - * http://oauth.net/core/1.0a/#auth_step3 - */ + * OAuth Core 1.0 Revision A: oauth_verifier: The verification code received from the Service Provider + * in the "Service Provider Directs the User Back to the Consumer" step. + * + * http://oauth.net/core/1.0a/#auth_step3 + */ if ('1.0a' == $this->oauth1Version) { $this->tokenExchangeParameters['oauth_verifier'] = $oauth_verifier; } @@ -452,50 +465,50 @@ abstract class OAuth1 extends AbstractAdapter implements AdapterInterface } /** - * Validate Access Token Response - * - * OAuth Core: If successful, the Service Provider generates an Access Token and Token Secret and returns - * them in the HTTP response body. - * - * The Access Token and Token Secret are stored by the Consumer and used when signing Protected Resources requests. - * - * http://oauth.net/core/1.0a/#auth_step3 - * 6.3.2. Service Provider Grants an Access Token - * - * @param string $response - * - * @return \Hybridauth\Data\Collection - * @throws InvalidAccessTokenException - */ + * Validate Access Token Response + * + * OAuth Core: If successful, the Service Provider generates an Access Token and Token Secret and returns + * them in the HTTP response body. + * + * The Access Token and Token Secret are stored by the Consumer and used when signing Protected Resources requests. + * + * http://oauth.net/core/1.0a/#auth_step3 + * 6.3.2. Service Provider Grants an Access Token + * + * @param string $response + * + * @return \Hybridauth\Data\Collection + * @throws InvalidAccessTokenException + */ protected function validateAccessTokenExchange($response) { /** - * The response contains the following parameters: - * - * - oauth_token The Access Token. - * - oauth_token_secret The Token Secret. - * - * http://oauth.net/core/1.0/#auth_step3 - * 6.3.2. Service Provider Grants an Access Token - * - * Example of a successful response: - * - * HTTP/1.1 200 OK - * Content-Type: text/html; charset=utf-8 - * Cache-Control: no-store - * Pragma: no-cache - * - * oauth_token=sHeLU7Far428zj8PzlWR75&oauth_token_secret=fXb30rzoG&oauth_callback_confirmed=true - * - * OAuthUtil::parse_parameters will attempt to decode the raw response into an array. - */ + * The response contains the following parameters: + * + * - oauth_token The Access Token. + * - oauth_token_secret The Token Secret. + * + * http://oauth.net/core/1.0/#auth_step3 + * 6.3.2. Service Provider Grants an Access Token + * + * Example of a successful response: + * + * HTTP/1.1 200 OK + * Content-Type: text/html; charset=utf-8 + * Cache-Control: no-store + * Pragma: no-cache + * + * oauth_token=sHeLU7Far428zj8PzlWR75&oauth_token_secret=fXb30rzoG&oauth_callback_confirmed=true + * + * OAuthUtil::parse_parameters will attempt to decode the raw response into an array. + */ $tokens = OAuthUtil::parse_parameters($response); $collection = new Data\Collection($tokens); - if (! $collection->exists('oauth_token')) { + if (!$collection->exists('oauth_token')) { throw new InvalidAccessTokenException( - 'Provider returned an invalid access_token: ' . htmlentities($response) + 'Provider returned no access_token: ' . htmlentities($response) ); } @@ -514,21 +527,21 @@ abstract class OAuth1 extends AbstractAdapter implements AdapterInterface } /** - * Send a signed request to provider API - * - * Note: Since the specifics of error responses is beyond the scope of RFC6749 and OAuth specifications, - * Hybridauth will consider any HTTP status code that is different than '200 OK' as an ERROR. - * - * @param string $url - * @param string $method - * @param array $parameters - * @param array $headers - * @param bool $multipart - * - * @return mixed - * @throws \Hybridauth\Exception\HttpClientFailureException - * @throws \Hybridauth\Exception\HttpRequestFailedException - */ + * Send a signed request to provider API + * + * Note: Since the specifics of error responses is beyond the scope of RFC6749 and OAuth specifications, + * Hybridauth will consider any HTTP status code that is different than '200 OK' as an ERROR. + * + * @param string $url + * @param string $method + * @param array $parameters + * @param array $headers + * @param bool $multipart + * + * @return mixed + * @throws \Hybridauth\Exception\HttpClientFailureException + * @throws \Hybridauth\Exception\HttpRequestFailedException + */ public function apiRequest($url, $method = 'GET', $parameters = [], $headers = [], $multipart = false) { if (strrpos($url, 'http://') !== 0 && strrpos($url, 'https://') !== 0) { @@ -547,20 +560,20 @@ abstract class OAuth1 extends AbstractAdapter implements AdapterInterface } /** - * Setup and Send a Signed Oauth Request - * - * This method uses OAuth Library. - * - * @param string $uri - * @param string $method - * @param array $parameters - * @param array $headers - * @param bool $multipart - * - * @return string Raw Provider API response - * @throws \Hybridauth\Exception\HttpClientFailureException - * @throws \Hybridauth\Exception\HttpRequestFailedException - */ + * Setup and Send a Signed Oauth Request + * + * This method uses OAuth Library. + * + * @param string $uri + * @param string $method + * @param array $parameters + * @param array $headers + * @param bool $multipart + * + * @return string Raw Provider API response + * @throws \Hybridauth\Exception\HttpClientFailureException + * @throws \Hybridauth\Exception\HttpRequestFailedException + */ protected function oauthRequest($uri, $method = 'GET', $parameters = [], $headers = [], $multipart = false) { $signing_parameters = $parameters; @@ -582,9 +595,8 @@ abstract class OAuth1 extends AbstractAdapter implements AdapterInterface $this->consumerToken ); - $uri = $request->get_normalized_http_url(); - $parameters = array_replace($parameters, $request->parameters); - $headers = array_replace($request->to_header(), (array) $headers); + $uri = $request->get_normalized_http_url(); + $headers = array_replace($request->to_header(), (array)$headers); $response = $this->httpClient->request( $uri, @@ -594,7 +606,7 @@ abstract class OAuth1 extends AbstractAdapter implements AdapterInterface $multipart ); - $this->validateApiResponse('Signed API request has returned an error'); + $this->validateApiResponse('Signed API request to ' . $uri . ' has returned an error'); return $response; } diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Adapter/OAuth2.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Adapter/OAuth2.php index e72765f51..a321a7f9b 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Adapter/OAuth2.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Adapter/OAuth2.php @@ -11,6 +11,7 @@ use Hybridauth\Exception\Exception; use Hybridauth\Exception\InvalidApplicationCredentialsException; use Hybridauth\Exception\InvalidAuthorizationStateException; use Hybridauth\Exception\InvalidAuthorizationCodeException; +use Hybridauth\Exception\AuthorizationDeniedException; use Hybridauth\Exception\InvalidAccessTokenException; use Hybridauth\Data; use Hybridauth\HttpClient; @@ -24,222 +25,231 @@ use Hybridauth\HttpClient; abstract class OAuth2 extends AbstractAdapter implements AdapterInterface { /** - * Client Identifier - * - * RFC6749: client_id REQUIRED. The client identifier issued to the client during - * the registration process described by Section 2.2. - * - * http://tools.ietf.org/html/rfc6749#section-2.2 - * - * @var string - */ - protected $clientId = '' ; + * Client Identifier + * + * RFC6749: client_id REQUIRED. The client identifier issued to the client during + * the registration process described by Section 2.2. + * + * http://tools.ietf.org/html/rfc6749#section-2.2 + * + * @var string + */ + protected $clientId = ''; /** - * Client Secret - * - * RFC6749: client_secret REQUIRED. The client secret. The client MAY omit the - * parameter if the client secret is an empty string. - * - * http://tools.ietf.org/html/rfc6749#section-2.2 - * - * @var string - */ - protected $clientSecret = '' ; + * Client Secret + * + * RFC6749: client_secret REQUIRED. The client secret. The client MAY omit the + * parameter if the client secret is an empty string. + * + * http://tools.ietf.org/html/rfc6749#section-2.2 + * + * @var string + */ + protected $clientSecret = ''; /** - * Access Token Scope - * - * RFC6749: The authorization and token endpoints allow the client to specify the - * scope of the access request using the "scope" request parameter. - * - * http://tools.ietf.org/html/rfc6749#section-3.3 - * - * @var string - */ + * Access Token Scope + * + * RFC6749: The authorization and token endpoints allow the client to specify the + * scope of the access request using the "scope" request parameter. + * + * http://tools.ietf.org/html/rfc6749#section-3.3 + * + * @var string + */ protected $scope = ''; /** - * Base URL to provider API - * - * This var will be used to build urls when sending signed requests - * - * @var string - */ + * Base URL to provider API + * + * This var will be used to build urls when sending signed requests + * + * @var string + */ protected $apiBaseUrl = ''; /** - * Authorization Endpoint - * - * RFC6749: The authorization endpoint is used to interact with the resource - * owner and obtain an authorization grant. - * - * http://tools.ietf.org/html/rfc6749#section-3.1 - * - * @var string - */ + * Authorization Endpoint + * + * RFC6749: The authorization endpoint is used to interact with the resource + * owner and obtain an authorization grant. + * + * http://tools.ietf.org/html/rfc6749#section-3.1 + * + * @var string + */ protected $authorizeUrl = ''; /** - * Access Token Endpoint - * - * RFC6749: The token endpoint is used by the client to obtain an access token by - * presenting its authorization grant or refresh token. - * - * http://tools.ietf.org/html/rfc6749#section-3.2 - * - * @var string - */ + * Access Token Endpoint + * + * RFC6749: The token endpoint is used by the client to obtain an access token by + * presenting its authorization grant or refresh token. + * + * http://tools.ietf.org/html/rfc6749#section-3.2 + * + * @var string + */ protected $accessTokenUrl = ''; /** - * TokenInfo endpoint - * - * Access token validation. OPTIONAL. - * - * @var string - */ + * TokenInfo endpoint + * + * Access token validation. OPTIONAL. + * + * @var string + */ protected $accessTokenInfoUrl = ''; /** - * IPD API Documentation - * - * OPTIONAL. - * - * @var string - */ + * IPD API Documentation + * + * OPTIONAL. + * + * @var string + */ protected $apiDocumentation = ''; /** - * Redirection Endpoint or Callback - * - * RFC6749: After completing its interaction with the resource owner, the - * authorization server directs the resource owner's user-agent back to - * the client. - * - * http://tools.ietf.org/html/rfc6749#section-3.1.2 - * - * @var string - */ + * Redirection Endpoint or Callback + * + * RFC6749: After completing its interaction with the resource owner, the + * authorization server directs the resource owner's user-agent back to + * the client. + * + * http://tools.ietf.org/html/rfc6749#section-3.1.2 + * + * @var string + */ protected $callback = ''; /** - * Authorization Url Parameters - * - * @var boolean - */ + * Authorization Url Parameters + * + * @var array + */ protected $AuthorizeUrlParameters = []; + /** - * Authorization Request State - * - * @var boolean - */ + * Authorization Url Parameter encoding type + * @see https://www.php.net/manual/de/function.http-build-query.php + * + * @var string + */ + protected $AuthorizeUrlParametersEncType = PHP_QUERY_RFC1738; + + /** + * Authorization Request State + * + * @var bool + */ protected $supportRequestState = true; /** - * Access Token name - * - * While most providers will use 'access_token' as name for the Access Token attribute, other do not. - * On the latter case, this should be set by sub classes. - * - * @var string - */ + * Access Token name + * + * While most providers will use 'access_token' as name for the Access Token attribute, other do not. + * On the latter case, this should be set by sub classes. + * + * @var string + */ protected $accessTokenName = 'access_token'; /** - * Authorization Request HTTP method. - * - * @see exchangeCodeForAccessToken() - * - * @var string - */ + * Authorization Request HTTP method. + * + * @see exchangeCodeForAccessToken() + * + * @var string + */ protected $tokenExchangeMethod = 'POST'; /** - * Authorization Request URL parameters. - * - * Sub classes may change add any additional parameter when necessary. - * - * @see exchangeCodeForAccessToken() - * - * @var array - */ + * Authorization Request URL parameters. + * + * Sub classes may change add any additional parameter when necessary. + * + * @see exchangeCodeForAccessToken() + * + * @var array + */ protected $tokenExchangeParameters = []; /** - * Authorization Request HTTP headers. - * - * Sub classes may add any additional header when necessary. - * - * @see exchangeCodeForAccessToken() - * - * @var array - */ + * Authorization Request HTTP headers. + * + * Sub classes may add any additional header when necessary. + * + * @see exchangeCodeForAccessToken() + * + * @var array + */ protected $tokenExchangeHeaders = []; /** - * Refresh Token Request HTTP method. - * - * @see refreshAccessToken() - * - * @var string - */ + * Refresh Token Request HTTP method. + * + * @see refreshAccessToken() + * + * @var string + */ protected $tokenRefreshMethod = 'POST'; /** - * Refresh Token Request URL parameters. - * - * Sub classes may change add any additional parameter when necessary. - * - * @see refreshAccessToken() - * - * @var array - */ - protected $tokenRefreshParameters = []; + * Refresh Token Request URL parameters. + * + * Sub classes may change add any additional parameter when necessary. + * + * @see refreshAccessToken() + * + * @var array|null + */ + protected $tokenRefreshParameters = null; /** - * Refresh Token Request HTTP headers. - * - * Sub classes may add any additional header when necessary. - * - * @see refreshAccessToken() - * - * @var array - */ + * Refresh Token Request HTTP headers. + * + * Sub classes may add any additional header when necessary. + * + * @see refreshAccessToken() + * + * @var array + */ protected $tokenRefreshHeaders = []; /** - * Authorization Request URL parameters. - * - * Sub classes may change add any additional parameter when necessary. - * - * @see apiRequest() - * - * @var array - */ + * Authorization Request URL parameters. + * + * Sub classes may change add any additional parameter when necessary. + * + * @see apiRequest() + * + * @var array + */ protected $apiRequestParameters = []; /** - * Authorization Request HTTP headers. - * - * Sub classes may add any additional header when necessary. - * - * @see apiRequest() - * - * @var array - */ + * Authorization Request HTTP headers. + * + * Sub classes may add any additional header when necessary. + * + * @see apiRequest() + * + * @var array + */ protected $apiRequestHeaders = []; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected function configure() { - $this->clientId = $this->config->filter('keys')->get('id') ?: $this->config->filter('keys')->get('key'); + $this->clientId = $this->config->filter('keys')->get('id') ?: $this->config->filter('keys')->get('key'); $this->clientSecret = $this->config->filter('keys')->get('secret'); - if (! $this->clientId || !$this->clientSecret) { + if (!$this->clientId || !$this->clientSecret) { throw new InvalidApplicationCredentialsException( 'Your application id is required in order to connect to ' . $this->providerId ); @@ -256,28 +266,31 @@ abstract class OAuth2 extends AbstractAdapter implements AdapterInterface } /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected function initialize() { $this->AuthorizeUrlParameters = [ 'response_type' => 'code', - 'client_id' => $this->clientId, - 'redirect_uri' => $this->callback, - 'scope' => $this->scope, + 'client_id' => $this->clientId, + 'redirect_uri' => $this->callback, + 'scope' => $this->scope, ]; $this->tokenExchangeParameters = [ - 'client_id' => $this->clientId, + 'client_id' => $this->clientId, 'client_secret' => $this->clientSecret, - 'grant_type' => 'authorization_code', - 'redirect_uri' => $this->callback + 'grant_type' => 'authorization_code', + 'redirect_uri' => $this->callback ]; - $this->tokenRefreshParameters = [ - 'grant_type' => 'refresh_token', - 'refresh_token' => $this->getStoredData('refresh_token'), - ]; + $refreshToken = $this->getStoredData('refresh_token'); + if (!empty($refreshToken)) { + $this->tokenRefreshParameters = [ + 'grant_type' => 'refresh_token', + 'refresh_token' => $refreshToken, + ]; + } $this->apiRequestHeaders = [ 'Authorization' => 'Bearer ' . $this->getStoredData('access_token') @@ -285,8 +298,8 @@ abstract class OAuth2 extends AbstractAdapter implements AdapterInterface } /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function authenticate() { $this->logger->info(sprintf('%s::authenticate()', get_class($this))); @@ -315,34 +328,62 @@ abstract class OAuth2 extends AbstractAdapter implements AdapterInterface } /** - * Authorization Request Error Response - * - * RFC6749: If the request fails due to a missing, invalid, or mismatching - * redirection URI, or if the client identifier is missing or invalid, - * the authorization server SHOULD inform the resource owner of the error. - * - * http://tools.ietf.org/html/rfc6749#section-4.1.2.1 - */ + * {@inheritdoc} + */ + public function isConnected() + { + if ((bool)$this->getStoredData('access_token')) { + return (!$this->hasAccessTokenExpired() || $this->isRefreshTokenAvailable()); + } + return false; + } + + /** + * If we can use a refresh token, then an expired token does not stop us being connected. + * + * @return bool + */ + public function isRefreshTokenAvailable() + { + return is_array($this->tokenRefreshParameters); + } + + /** + * Authorization Request Error Response + * + * RFC6749: If the request fails due to a missing, invalid, or mismatching + * redirection URI, or if the client identifier is missing or invalid, + * the authorization server SHOULD inform the resource owner of the error. + * + * http://tools.ietf.org/html/rfc6749#section-4.1.2.1 + * + * @throws \Hybridauth\Exception\InvalidAuthorizationCodeException + * @throws \Hybridauth\Exception\AuthorizationDeniedException + */ protected function authenticateCheckError() { $error = filter_input(INPUT_GET, 'error', FILTER_SANITIZE_SPECIAL_CHARS); - if (! empty($error)) { + if (!empty($error)) { $error_description = filter_input(INPUT_GET, 'error_description', FILTER_SANITIZE_SPECIAL_CHARS); $error_uri = filter_input(INPUT_GET, 'error_uri', FILTER_SANITIZE_SPECIAL_CHARS); - throw new InvalidAuthorizationCodeException( - sprintf('Provider returned an error: %s %s %s', $error, $error_description, $error_uri) - ); + $collated_error = sprintf('Provider returned an error: %s %s %s', $error, $error_description, $error_uri); + + if ($error == 'access_denied') { + throw new AuthorizationDeniedException($collated_error); + } + + throw new InvalidAuthorizationCodeException($collated_error); } } /** - * Initiate the authorization protocol - * - * Build Authorization URL for Authorization Request and redirect the user-agent to the - * Authorization Server. - */ + * Initiate the authorization protocol + * + * Build Authorization URL for Authorization Request and redirect the user-agent to the + * Authorization Server. + */ protected function authenticateBegin() { $authUrl = $this->getAuthorizeUrl(); @@ -353,13 +394,13 @@ abstract class OAuth2 extends AbstractAdapter implements AdapterInterface } /** - * Finalize the authorization process - * - * @throws \Hybridauth\Exception\HttpClientFailureException - * @throws \Hybridauth\Exception\HttpRequestFailedException - * @throws InvalidAccessTokenException - * @throws InvalidAuthorizationStateException - */ + * Finalize the authorization process + * + * @throws \Hybridauth\Exception\HttpClientFailureException + * @throws \Hybridauth\Exception\HttpRequestFailedException + * @throws InvalidAccessTokenException + * @throws InvalidAuthorizationStateException + */ protected function authenticateFinish() { $this->logger->debug( @@ -371,31 +412,31 @@ abstract class OAuth2 extends AbstractAdapter implements AdapterInterface $code = filter_input($_SERVER['REQUEST_METHOD'] === 'POST' ? INPUT_POST : INPUT_GET, 'code'); /** - * Authorization Request State - * - * RFC6749: state : RECOMMENDED. An opaque value used by the client to maintain - * state between the request and callback. The authorization server includes - * this value when redirecting the user-agent back to the client. - * - * http://tools.ietf.org/html/rfc6749#section-4.1.1 - */ + * Authorization Request State + * + * RFC6749: state : RECOMMENDED. An opaque value used by the client to maintain + * state between the request and callback. The authorization server includes + * this value when redirecting the user-agent back to the client. + * + * http://tools.ietf.org/html/rfc6749#section-4.1.1 + */ if ($this->supportRequestState - && $this->getStoredData('authorization_state') != $state + && $this->getStoredData('authorization_state') != $state ) { throw new InvalidAuthorizationStateException( - 'The authorization state [state=' . substr(htmlentities($state), 0, 100). '] ' - . 'of this page is either invalid or has already been consumed.' + 'The authorization state [state=' . substr(htmlentities($state), 0, 100) . '] ' + . 'of this page is either invalid or has already been consumed.' ); } /** - * Authorization Request Code - * - * RFC6749: If the resource owner grants the access request, the authorization - * server issues an authorization code and delivers it to the client: - * - * http://tools.ietf.org/html/rfc6749#section-4.1.2 - */ + * Authorization Request Code + * + * RFC6749: If the resource owner grants the access request, the authorization + * server issues an authorization code and delivers it to the client: + * + * http://tools.ietf.org/html/rfc6749#section-4.1.2 + */ $response = $this->exchangeCodeForAccessToken($code); $this->validateAccessTokenExchange($response); @@ -404,32 +445,32 @@ abstract class OAuth2 extends AbstractAdapter implements AdapterInterface } /** - * Build Authorization URL for Authorization Request - * - * RFC6749: The client constructs the request URI by adding the following - * $parameters to the query component of the authorization endpoint URI: - * - * - response_type REQUIRED. Value MUST be set to "code". - * - client_id REQUIRED. - * - redirect_uri OPTIONAL. - * - scope OPTIONAL. - * - state RECOMMENDED. - * - * http://tools.ietf.org/html/rfc6749#section-4.1.1 - * - * Sub classes may redefine this method when necessary. - * - * @param array $parameters - * - * @return string Authorization URL - */ + * Build Authorization URL for Authorization Request + * + * RFC6749: The client constructs the request URI by adding the following + * $parameters to the query component of the authorization endpoint URI: + * + * - response_type REQUIRED. Value MUST be set to "code". + * - client_id REQUIRED. + * - redirect_uri OPTIONAL. + * - scope OPTIONAL. + * - state RECOMMENDED. + * + * http://tools.ietf.org/html/rfc6749#section-4.1.1 + * + * Sub classes may redefine this method when necessary. + * + * @param array $parameters + * + * @return string Authorization URL + */ protected function getAuthorizeUrl($parameters = []) { $this->AuthorizeUrlParameters = !empty($parameters) ? $parameters : array_replace( - (array) $this->AuthorizeUrlParameters, - (array) $this->config->get('authorize_url_parameters') + (array)$this->AuthorizeUrlParameters, + (array)$this->config->get('authorize_url_parameters') ); if ($this->supportRequestState) { @@ -440,31 +481,32 @@ abstract class OAuth2 extends AbstractAdapter implements AdapterInterface $this->storeData('authorization_state', $this->AuthorizeUrlParameters['state']); } - return $this->authorizeUrl . '?' . http_build_query($this->AuthorizeUrlParameters, '', '&'); + $queryParams = http_build_query($this->AuthorizeUrlParameters, '', '&', $this->AuthorizeUrlParametersEncType); + return $this->authorizeUrl . '?' . $queryParams; } /** - * Access Token Request - * - * This method will exchange the received $code in loginFinish() with an Access Token. - * - * RFC6749: The client makes a request to the token endpoint by sending the - * following parameters using the "application/x-www-form-urlencoded" - * with a character encoding of UTF-8 in the HTTP request entity-body: - * - * - grant_type REQUIRED. Value MUST be set to "authorization_code". - * - code REQUIRED. The authorization code received from the authorization server. - * - redirect_uri REQUIRED. - * - client_id REQUIRED. - * - * http://tools.ietf.org/html/rfc6749#section-4.1.3 - * - * @param string $code - * - * @return string Raw Provider API response - * @throws \Hybridauth\Exception\HttpClientFailureException - * @throws \Hybridauth\Exception\HttpRequestFailedException - */ + * Access Token Request + * + * This method will exchange the received $code in loginFinish() with an Access Token. + * + * RFC6749: The client makes a request to the token endpoint by sending the + * following parameters using the "application/x-www-form-urlencoded" + * with a character encoding of UTF-8 in the HTTP request entity-body: + * + * - grant_type REQUIRED. Value MUST be set to "authorization_code". + * - code REQUIRED. The authorization code received from the authorization server. + * - redirect_uri REQUIRED. + * - client_id REQUIRED. + * + * http://tools.ietf.org/html/rfc6749#section-4.1.3 + * + * @param string $code + * + * @return string Raw Provider API response + * @throws \Hybridauth\Exception\HttpClientFailureException + * @throws \Hybridauth\Exception\HttpRequestFailedException + */ protected function exchangeCodeForAccessToken($code) { $this->tokenExchangeParameters['code'] = $code; @@ -482,47 +524,47 @@ abstract class OAuth2 extends AbstractAdapter implements AdapterInterface } /** - * Validate Access Token Response - * - * RFC6749: If the access token request is valid and authorized, the - * authorization server issues an access token and optional refresh token. - * If the request client authentication failed or is invalid, the authorization - * server returns an error response as described in Section 5.2. - * - * Example of a successful response: - * - * HTTP/1.1 200 OK - * Content-Type: application/json;charset=UTF-8 - * Cache-Control: no-store - * Pragma: no-cache - * - * { - * "access_token":"2YotnFZFEjr1zCsicMWpAA", - * "token_type":"example", - * "expires_in":3600, - * "refresh_token":"tGzv3JOkF0XG5Qx2TlKWIA", - * "example_parameter":"example_value" - * } - * - * http://tools.ietf.org/html/rfc6749#section-4.1.4 - * - * This method uses Data_Parser to attempt to decodes the raw $response (usually JSON) - * into a data collection. - * - * @param string $response - * - * @return \Hybridauth\Data\Collection - * @throws InvalidAccessTokenException - */ + * Validate Access Token Response + * + * RFC6749: If the access token request is valid and authorized, the + * authorization server issues an access token and optional refresh token. + * If the request client authentication failed or is invalid, the authorization + * server returns an error response as described in Section 5.2. + * + * Example of a successful response: + * + * HTTP/1.1 200 OK + * Content-Type: application/json;charset=UTF-8 + * Cache-Control: no-store + * Pragma: no-cache + * + * { + * "access_token":"2YotnFZFEjr1zCsicMWpAA", + * "token_type":"example", + * "expires_in":3600, + * "refresh_token":"tGzv3JOkF0XG5Qx2TlKWIA", + * "example_parameter":"example_value" + * } + * + * http://tools.ietf.org/html/rfc6749#section-4.1.4 + * + * This method uses Data_Parser to attempt to decodes the raw $response (usually JSON) + * into a data collection. + * + * @param string $response + * + * @return \Hybridauth\Data\Collection + * @throws InvalidAccessTokenException + */ protected function validateAccessTokenExchange($response) { $data = (new Data\Parser())->parse($response); $collection = new Data\Collection($data); - if (! $collection->exists('access_token')) { + if (!$collection->exists('access_token')) { throw new InvalidAccessTokenException( - 'Provider returned an invalid access_token: ' . htmlentities($response) + 'Provider returned no access_token: ' . htmlentities($response) ); } @@ -535,7 +577,7 @@ abstract class OAuth2 extends AbstractAdapter implements AdapterInterface // calculate when the access token expire if ($collection->exists('expires_in')) { - $expires_at = time() + (int) $collection->get('expires_in'); + $expires_at = time() + (int)$collection->get('expires_in'); $this->storeData('expires_in', $collection->get('expires_in')); $this->storeData('expires_at', $expires_at); @@ -549,34 +591,38 @@ abstract class OAuth2 extends AbstractAdapter implements AdapterInterface } /** - * Refreshing an Access Token - * - * RFC6749: If the authorization server issued a refresh token to the - * client, the client makes a refresh request to the token endpoint by - * adding the following parameters ... in the HTTP request entity-body: - * - * - grant_type REQUIRED. Value MUST be set to "refresh_token". - * - refresh_token REQUIRED. The refresh token issued to the client. - * - scope OPTIONAL. - * - * http://tools.ietf.org/html/rfc6749#section-6 - * - * This method is similar to exchangeCodeForAccessToken(). The only - * difference is here we exchange refresh_token for a new access_token. - * - * @param array $parameters - * - * @return string Raw Provider API response - * @throws \Hybridauth\Exception\HttpClientFailureException - * @throws \Hybridauth\Exception\HttpRequestFailedException - * @throws InvalidAccessTokenException - */ + * Refreshing an Access Token + * + * RFC6749: If the authorization server issued a refresh token to the + * client, the client makes a refresh request to the token endpoint by + * adding the following parameters ... in the HTTP request entity-body: + * + * - grant_type REQUIRED. Value MUST be set to "refresh_token". + * - refresh_token REQUIRED. The refresh token issued to the client. + * - scope OPTIONAL. + * + * http://tools.ietf.org/html/rfc6749#section-6 + * + * This method is similar to exchangeCodeForAccessToken(). The only + * difference is here we exchange refresh_token for a new access_token. + * + * @param array $parameters + * + * @return string|null Raw Provider API response, or null if we cannot refresh + * @throws \Hybridauth\Exception\HttpClientFailureException + * @throws \Hybridauth\Exception\HttpRequestFailedException + * @throws InvalidAccessTokenException + */ public function refreshAccessToken($parameters = []) { $this->tokenRefreshParameters = !empty($parameters) ? $parameters : $this->tokenRefreshParameters; + if (!$this->isRefreshTokenAvailable()) { + return null; + } + $response = $this->httpClient->request( $this->accessTokenUrl, $this->tokenRefreshMethod, @@ -592,70 +638,75 @@ abstract class OAuth2 extends AbstractAdapter implements AdapterInterface } /** - * Check whether access token has expired - * - * @return bool|null - */ - public function hasAccessTokenExpired() + * Check whether access token has expired + * + * @param int|null $time + * @return bool|null + */ + public function hasAccessTokenExpired($time = null) { + if ($time === null) { + $time = time(); + } + $expires_at = $this->getStoredData('expires_at'); if (!$expires_at) { return null; } - return $expires_at <= time(); + return $expires_at <= $time; } /** - * Validate Refresh Access Token Request - * - * RFC6749: If valid and authorized, the authorization server issues an - * access token as described in Section 5.1. If the request failed - * verification or is invalid, the authorization server returns an error - * response as described in Section 5.2. - * - * http://tools.ietf.org/html/rfc6749#section-6 - * http://tools.ietf.org/html/rfc6749#section-5.1 - * http://tools.ietf.org/html/rfc6749#section-5.2 - * - * This method simply use validateAccessTokenExchange(), however sub - * classes may redefine it when necessary. - * - * @param $response - * - * @return \Hybridauth\Data\Collection - * @throws InvalidAccessTokenException - */ + * Validate Refresh Access Token Request + * + * RFC6749: If valid and authorized, the authorization server issues an + * access token as described in Section 5.1. If the request failed + * verification or is invalid, the authorization server returns an error + * response as described in Section 5.2. + * + * http://tools.ietf.org/html/rfc6749#section-6 + * http://tools.ietf.org/html/rfc6749#section-5.1 + * http://tools.ietf.org/html/rfc6749#section-5.2 + * + * This method simply use validateAccessTokenExchange(), however sub + * classes may redefine it when necessary. + * + * @param $response + * + * @return \Hybridauth\Data\Collection + * @throws InvalidAccessTokenException + */ protected function validateRefreshAccessToken($response) { return $this->validateAccessTokenExchange($response); } /** - * Send a signed request to provider API - * - * RFC6749: Accessing Protected Resources: The client accesses protected - * resources by presenting the access token to the resource server. The - * resource server MUST validate the access token and ensure that it has - * not expired and that its scope covers the requested resource. - * - * Note: Since the specifics of error responses is beyond the scope of - * RFC6749 and OAuth specifications, Hybridauth will consider any HTTP - * status code that is different than '200 OK' as an ERROR. - * - * http://tools.ietf.org/html/rfc6749#section-7 - * - * @param string $url - * @param string $method - * @param array $parameters - * @param array $headers - * @param bool $multipart - * - * @return mixed - * @throws \Hybridauth\Exception\HttpClientFailureException - * @throws \Hybridauth\Exception\HttpRequestFailedException - * @throws InvalidAccessTokenException - */ + * Send a signed request to provider API + * + * RFC6749: Accessing Protected Resources: The client accesses protected + * resources by presenting the access token to the resource server. The + * resource server MUST validate the access token and ensure that it has + * not expired and that its scope covers the requested resource. + * + * Note: Since the specifics of error responses is beyond the scope of + * RFC6749 and OAuth specifications, Hybridauth will consider any HTTP + * status code that is different than '200 OK' as an ERROR. + * + * http://tools.ietf.org/html/rfc6749#section-7 + * + * @param string $url + * @param string $method + * @param array $parameters + * @param array $headers + * @param bool $multipart + * + * @return mixed + * @throws \Hybridauth\Exception\HttpClientFailureException + * @throws \Hybridauth\Exception\HttpRequestFailedException + * @throws InvalidAccessTokenException + */ public function apiRequest($url, $method = 'GET', $parameters = [], $headers = [], $multipart = false) { // refresh tokens if needed @@ -667,8 +718,8 @@ abstract class OAuth2 extends AbstractAdapter implements AdapterInterface $url = rtrim($this->apiBaseUrl, '/') . '/' . ltrim($url, '/'); } - $parameters = array_replace($this->apiRequestParameters, (array) $parameters); - $headers = array_replace($this->apiRequestHeaders, (array) $headers); + $parameters = array_replace($this->apiRequestParameters, (array)$parameters); + $headers = array_replace($this->apiRequestHeaders, (array)$headers); $response = $this->httpClient->request( $url, @@ -678,7 +729,7 @@ abstract class OAuth2 extends AbstractAdapter implements AdapterInterface $multipart // Is request multipart ); - $this->validateApiResponse('Signed API request has returned an error'); + $this->validateApiResponse('Signed API request to ' . $url . ' has returned an error'); $response = (new Data\Parser())->parse($response); diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Adapter/OpenID.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Adapter/OpenID.php index 1d83fb96e..35956d6f1 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Adapter/OpenID.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Adapter/OpenID.php @@ -25,22 +25,22 @@ use Hybridauth\Thirdparty\OpenID\LightOpenID; abstract class OpenID extends AbstractAdapter implements AdapterInterface { /** - * LightOpenID instance - * - * @var object - */ + * LightOpenID instance + * + * @var object + */ protected $openIdClient = null; /** - * Openid provider identifier - * - * @var string - */ + * Openid provider identifier + * + * @var string + */ protected $openidIdentifier = ''; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected function configure() { if ($this->config->exists('openid_identifier')) { @@ -56,12 +56,12 @@ abstract class OpenID extends AbstractAdapter implements AdapterInterface } /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected function initialize() { $hostPort = parse_url($this->callback, PHP_URL_PORT); - $hostUrl = parse_url($this->callback, PHP_URL_HOST); + $hostUrl = parse_url($this->callback, PHP_URL_HOST); if ($hostPort) { $hostUrl .= ':' . $hostPort; @@ -72,8 +72,8 @@ abstract class OpenID extends AbstractAdapter implements AdapterInterface } /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function authenticate() { $this->logger->info(sprintf('%s::authenticate()', get_class($this))); @@ -92,16 +92,16 @@ abstract class OpenID extends AbstractAdapter implements AdapterInterface } /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function isConnected() { - return (bool) $this->storage->get($this->providerId . '.user'); + return (bool)$this->storage->get($this->providerId . '.user'); } /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function disconnect() { $this->storage->delete($this->providerId . '.user'); @@ -110,31 +110,31 @@ abstract class OpenID extends AbstractAdapter implements AdapterInterface } /** - * Initiate the authorization protocol - * - * Include and instantiate LightOpenID - */ + * Initiate the authorization protocol + * + * Include and instantiate LightOpenID + */ protected function authenticateBegin() { - $this->openIdClient->identity = $this->openidIdentifier; + $this->openIdClient->identity = $this->openidIdentifier; $this->openIdClient->returnUrl = $this->callback; - $this->openIdClient->required = [ - 'namePerson/first' , - 'namePerson/last' , - 'namePerson/friendly' , - 'namePerson' , - 'contact/email' , - 'birthDate' , - 'birthDate/birthDay' , - 'birthDate/birthMonth' , - 'birthDate/birthYear' , - 'person/gender' , - 'pref/language' , + $this->openIdClient->required = [ + 'namePerson/first', + 'namePerson/last', + 'namePerson/friendly', + 'namePerson', + 'contact/email', + 'birthDate', + 'birthDate/birthDay', + 'birthDate/birthMonth', + 'birthDate/birthYear', + 'person/gender', + 'pref/language', 'contact/postalCode/home', - 'contact/city/home' , - 'contact/country/home' , + 'contact/city/home', + 'contact/country/home', - 'media/image/default' , + 'media/image/default', ]; $authUrl = $this->openIdClient->authUrl(); @@ -145,11 +145,11 @@ abstract class OpenID extends AbstractAdapter implements AdapterInterface } /** - * Finalize the authorization process. - * - * @throws AuthorizationDeniedException - * @throws UnexpectedApiResponseException - */ + * Finalize the authorization process. + * + * @throws AuthorizationDeniedException + * @throws UnexpectedApiResponseException + */ protected function authenticateFinish() { $this->logger->debug( @@ -161,13 +161,13 @@ abstract class OpenID extends AbstractAdapter implements AdapterInterface throw new AuthorizationDeniedException('User has cancelled the authentication.'); } - if (! $this->openIdClient->validate()) { + if (!$this->openIdClient->validate()) { throw new UnexpectedApiResponseException('Invalid response received.'); } $openidAttributes = $this->openIdClient->getAttributes(); - if (! $this->openIdClient->identity) { + if (!$this->openIdClient->identity) { throw new UnexpectedApiResponseException('Provider returned an unexpected response.'); } @@ -178,31 +178,31 @@ abstract class OpenID extends AbstractAdapter implements AdapterInterface } /** - * Fetch user profile from received openid attributes - * - * @param array $openidAttributes - * - * @return User\Profile - */ + * Fetch user profile from received openid attributes + * + * @param array $openidAttributes + * + * @return User\Profile + */ protected function fetchUserProfile($openidAttributes) { $data = new Data\Collection($openidAttributes); $userProfile = new User\Profile(); - $userProfile->identifier = $this->openIdClient->identity; + $userProfile->identifier = $this->openIdClient->identity; - $userProfile->firstName = $data->get('namePerson/first'); - $userProfile->lastName = $data->get('namePerson/last'); - $userProfile->email = $data->get('contact/email'); - $userProfile->language = $data->get('pref/language'); - $userProfile->country = $data->get('contact/country/home'); - $userProfile->zip = $data->get('contact/postalCode/home'); - $userProfile->gender = $data->get('person/gender'); - $userProfile->photoURL = $data->get('media/image/default'); - $userProfile->birthDay = $data->get('birthDate/birthDay'); - $userProfile->birthMonth = $data->get('birthDate/birthMonth'); - $userProfile->birthYear = $data->get('birthDate/birthDate'); + $userProfile->firstName = $data->get('namePerson/first'); + $userProfile->lastName = $data->get('namePerson/last'); + $userProfile->email = $data->get('contact/email'); + $userProfile->language = $data->get('pref/language'); + $userProfile->country = $data->get('contact/country/home'); + $userProfile->zip = $data->get('contact/postalCode/home'); + $userProfile->gender = $data->get('person/gender'); + $userProfile->photoURL = $data->get('media/image/default'); + $userProfile->birthDay = $data->get('birthDate/birthDay'); + $userProfile->birthMonth = $data->get('birthDate/birthMonth'); + $userProfile->birthYear = $data->get('birthDate/birthDate'); $userProfile = $this->fetchUserGender($userProfile, $data->get('person/gender')); @@ -212,36 +212,36 @@ abstract class OpenID extends AbstractAdapter implements AdapterInterface } /** - * Extract users display names - * - * @param User\Profile $userProfile - * @param Data\Collection $data - * - * @return User\Profile - */ + * Extract users display names + * + * @param User\Profile $userProfile + * @param Data\Collection $data + * + * @return User\Profile + */ protected function fetchUserDisplayName(User\Profile $userProfile, Data\Collection $data) { $userProfile->displayName = $data->get('namePerson'); $userProfile->displayName = $userProfile->displayName - ? $userProfile->displayName - : $data->get('namePerson/friendly'); + ? $userProfile->displayName + : $data->get('namePerson/friendly'); $userProfile->displayName = $userProfile->displayName - ? $userProfile->displayName - : trim($userProfile->firstName . ' ' . $userProfile->lastName); + ? $userProfile->displayName + : trim($userProfile->firstName . ' ' . $userProfile->lastName); return $userProfile; } /** - * Extract users gender - * - * @param User\Profile $userProfile - * @param string $gender - * - * @return User\Profile - */ + * Extract users gender + * + * @param User\Profile $userProfile + * @param string $gender + * + * @return User\Profile + */ protected function fetchUserGender(User\Profile $userProfile, $gender) { $gender = strtolower($gender); @@ -260,13 +260,13 @@ abstract class OpenID extends AbstractAdapter implements AdapterInterface } /** - * OpenID only provide the user profile one. This method will attempt to retrieve the profile from storage. - */ + * OpenID only provide the user profile one. This method will attempt to retrieve the profile from storage. + */ public function getUserProfile() { $userProfile = $this->storage->get($this->providerId . '.user'); - if (! is_object($userProfile)) { + if (!is_object($userProfile)) { throw new UnexpectedApiResponseException('Provider returned an unexpected response.'); } diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Data/Collection.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Data/Collection.php index cbcd21cb9..2a46fc3d6 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Data/Collection.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Data/Collection.php @@ -13,15 +13,15 @@ namespace Hybridauth\Data; final class Collection { /** - * Data collection - * - * @var mixed - */ + * Data collection + * + * @var mixed + */ protected $collection = null; /** - * @param mixed $data - */ + * @param mixed $data + */ public function __construct($data = null) { $this->collection = new \stdClass(); @@ -30,26 +30,26 @@ final class Collection $this->collection = $data; } - $this->collection = (object) $data; + $this->collection = (object)$data; } /** - * Retrieves the whole collection as array - * - * @return mixed - */ + * Retrieves the whole collection as array + * + * @return mixed + */ public function toArray() { - return (array) $this->collection; + return (array)$this->collection; } /** - * Retrieves an item - * - * @param $property - * - * @return mixed - */ + * Retrieves an item + * + * @param $property + * + * @return mixed + */ public function get($property) { if ($this->exists($property)) { @@ -60,11 +60,11 @@ final class Collection } /** - * Add or update an item - * - * @param $property - * @param mixed $value - */ + * Add or update an item + * + * @param $property + * @param mixed $value + */ public function set($property, $value) { if ($property) { @@ -73,18 +73,18 @@ final class Collection } /** - * .. until I come with a better name.. - * - * @param $property - * - * @return Collection - */ + * .. until I come with a better name.. + * + * @param $property + * + * @return Collection + */ public function filter($property) { if ($this->exists($property)) { $data = $this->get($property); - if (! is_a($data, 'Collection')) { + if (!is_a($data, 'Collection')) { $data = new Collection($data); } @@ -95,42 +95,42 @@ final class Collection } /** - * Checks whether an item within the collection - * - * @param $property - * - * @return bool - */ + * Checks whether an item within the collection + * + * @param $property + * + * @return bool + */ public function exists($property) { return property_exists($this->collection, $property); } /** - * Finds whether the collection is empty - * - * @return bool - */ + * Finds whether the collection is empty + * + * @return bool + */ public function isEmpty() { - return ! (bool) $this->count(); + return !(bool)$this->count(); } /** - * Count all items in collection - * - * @return int - */ + * Count all items in collection + * + * @return int + */ public function count() { return count($this->properties()); } /** - * Returns all items properties names - * - * @return array - */ + * Returns all items properties names + * + * @return array + */ public function properties() { $properties = []; @@ -143,10 +143,10 @@ final class Collection } /** - * Returns all items values - * - * @return array - */ + * Returns all items values + * + * @return array + */ public function values() { $values = []; diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Data/Parser.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Data/Parser.php index 1662fec9b..46939e36d 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Data/Parser.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Data/Parser.php @@ -16,23 +16,23 @@ namespace Hybridauth\Data; final class Parser { /** - * Decodes a string into an object. - * - * This method will first attempt to parse data as a JSON string (since most providers use this format) - * then XML and parse_str. - * - * @param string $raw - * - * @return mixed - */ + * Decodes a string into an object. + * + * This method will first attempt to parse data as a JSON string (since most providers use this format) + * then XML and parse_str. + * + * @param string $raw + * + * @return mixed + */ public function parse($raw = null) { $data = $this->parseJson($raw); - if (! $data) { + if (!$data) { $data = $this->parseXml($raw); - - if (! $data) { + + if (!$data) { $data = $this->parseQueryString($raw); } } @@ -41,12 +41,12 @@ final class Parser } /** - * Decodes a JSON string - * - * @param $result - * - * @return mixed - */ + * Decodes a JSON string + * + * @param $result + * + * @return mixed + */ public function parseJson($result) { return json_decode($result); @@ -65,31 +65,31 @@ final class Parser $result = preg_replace('/([<<\/])([a-z0-9-]+):/i', '$1', $result); $xml = simplexml_load_string($result); - + libxml_use_internal_errors(false); - - if (! $xml) { + + if (!$xml) { return []; } - $arr = json_decode(json_encode((array) $xml), true); + $arr = json_decode(json_encode((array)$xml), true); $arr = array($xml->getName() => $arr); return $arr; } /** - * Parses a string into variables - * - * @param $result - * - * @return \StdClass - */ + * Parses a string into variables + * + * @param $result + * + * @return \StdClass + */ public function parseQueryString($result) { parse_str($result, $output); - if (! is_array($output)) { + if (!is_array($output)) { return $result; } @@ -114,6 +114,6 @@ final class Parser { $birthday = date_parse($birthday); - return [ $birthday['year'], $birthday['month'], $birthday['day'] ]; + return [$birthday['year'], $birthday['month'], $birthday['day']]; } } diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Exception/Exception.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Exception/Exception.php index 2745ecc00..d6f3895a5 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Exception/Exception.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Exception/Exception.php @@ -13,21 +13,21 @@ namespace Hybridauth\Exception; class Exception extends \Exception implements ExceptionInterface { /** - * Shamelessly Borrowed from Slimframework - * - * @param $object - */ + * Shamelessly Borrowed from Slimframework + * + * @param $object + */ public function debug($object) { - $title = 'Hybridauth Exception'; - $code = $this->getCode(); + $title = 'Hybridauth Exception'; + $code = $this->getCode(); $message = $this->getMessage(); - $file = $this->getFile(); - $line = $this->getLine(); - $trace = $this->getTraceAsString(); + $file = $this->getFile(); + $line = $this->getLine(); + $trace = $this->getTraceAsString(); - $html = sprintf('

%s

', $title); - $html .= '

HybridAuth has encountered the following error:

'; + $html = sprintf('

%s

', $title); + $html .= '

Hybridauth has encountered the following error:

'; $html .= '

Details

'; $html .= sprintf('
Exception: %s
', get_class($this)); diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/HttpClient/Curl.php b/e107_handlers/vendor/hybridauth/hybridauth/src/HttpClient/Curl.php index 75d30536d..e150d2d6b 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/HttpClient/Curl.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/HttpClient/Curl.php @@ -8,103 +8,103 @@ namespace Hybridauth\HttpClient; /** - * HybridAuth default Http client + * Hybridauth default Http client */ class Curl implements HttpClientInterface { /** - * Default curl options - * - * These defaults options can be overwritten when sending requests. - * - * See setCurlOptions() - * - * @var array - */ + * Default curl options + * + * These defaults options can be overwritten when sending requests. + * + * See setCurlOptions() + * + * @var array + */ protected $curlOptions = [ - CURLOPT_TIMEOUT => 30, + CURLOPT_TIMEOUT => 30, CURLOPT_CONNECTTIMEOUT => 30, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION => true, - CURLOPT_MAXREDIRS => 5, - CURLINFO_HEADER_OUT => true, - CURLOPT_ENCODING => 'identity', + CURLOPT_MAXREDIRS => 5, + CURLINFO_HEADER_OUT => true, + CURLOPT_ENCODING => 'identity', // phpcs:ignore - CURLOPT_USERAGENT => 'HybridAuth, PHP Social Authentication Library (https://github.com/hybridauth/hybridauth)', + CURLOPT_USERAGENT => 'Hybridauth, PHP Social Authentication Library (https://github.com/hybridauth/hybridauth)', ]; /** - * Method request() arguments - * - * This is used for debugging. - * - * @var array - */ + * Method request() arguments + * + * This is used for debugging. + * + * @var array + */ protected $requestArguments = []; /** - * Default request headers - * - * @var array - */ + * Default request headers + * + * @var array + */ protected $requestHeader = [ - 'Accept' => '*/*', - 'Cache-Control' => 'max-age=0', - 'Connection' => 'keep-alive', - 'Expect' => '', - 'Pragma' => '', + 'Accept' => '*/*', + 'Cache-Control' => 'max-age=0', + 'Connection' => 'keep-alive', + 'Expect' => '', + 'Pragma' => '', ]; /** - * Raw response returned by server - * - * @var string - */ + * Raw response returned by server + * + * @var string + */ protected $responseBody = ''; /** - * Headers returned in the response - * - * @var array - */ + * Headers returned in the response + * + * @var array + */ protected $responseHeader = []; /** - * Response HTTP status code - * - * @var integer - */ + * Response HTTP status code + * + * @var int + */ protected $responseHttpCode = 0; /** - * Last curl error number - * - * @var mixed - */ + * Last curl error number + * + * @var mixed + */ protected $responseClientError = null; /** - * Information about the last transfer - * - * @var mixed - */ + * Information about the last transfer + * + * @var mixed + */ protected $responseClientInfo = []; /** - * Hybridauth logger instance - * - * @var object - */ + * Hybridauth logger instance + * + * @var object + */ protected $logger = null; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function request($uri, $method = 'GET', $parameters = [], $headers = [], $multipart = false) { - $this->requestHeader = array_replace($this->requestHeader, (array) $headers); + $this->requestHeader = array_replace($this->requestHeader, (array)$headers); $this->requestArguments = [ 'uri' => $uri, @@ -145,9 +145,9 @@ class Curl implements HttpClientInterface break; } - $this->curlOptions[CURLOPT_URL] = $uri; - $this->curlOptions[CURLOPT_HTTPHEADER] = $this->prepareRequestHeaders(); - $this->curlOptions[CURLOPT_HEADERFUNCTION] = [ $this, 'fetchResponseHeader' ]; + $this->curlOptions[CURLOPT_URL] = $uri; + $this->curlOptions[CURLOPT_HTTPHEADER] = $this->prepareRequestHeaders(); + $this->curlOptions[CURLOPT_HEADERFUNCTION] = [$this, 'fetchResponseHeader']; foreach ($this->curlOptions as $opt => $value) { curl_setopt($curl, $opt, $value); @@ -155,10 +155,10 @@ class Curl implements HttpClientInterface $response = curl_exec($curl); - $this->responseBody = $response; - $this->responseHttpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); + $this->responseBody = $response; + $this->responseHttpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); $this->responseClientError = curl_error($curl); - $this->responseClientInfo = curl_getinfo($curl); + $this->responseClientInfo = curl_getinfo($curl); if ($this->logger) { // phpcs:ignore @@ -176,8 +176,8 @@ class Curl implements HttpClientInterface } /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function getResponse() { $curlOptions = $this->curlOptions; @@ -187,126 +187,126 @@ class Curl implements HttpClientInterface return [ 'request' => $this->getRequestArguments(), 'response' => [ - 'code' => $this->getResponseHttpCode(), + 'code' => $this->getResponseHttpCode(), 'headers' => $this->getResponseHeader(), - 'body' => $this->getResponseBody(), + 'body' => $this->getResponseBody(), ], 'client' => [ 'error' => $this->getResponseClientError(), - 'info' => $this->getResponseClientInfo(), - 'opts' => $curlOptions, + 'info' => $this->getResponseClientInfo(), + 'opts' => $curlOptions, ], ]; } /** - * Reset curl options - * - * @param array $curlOptions - */ + * Reset curl options + * + * @param array $curlOptions + */ public function setCurlOptions($curlOptions) { foreach ($curlOptions as $opt => $value) { - $this->curlOptions[ $opt ] = $value; + $this->curlOptions[$opt] = $value; } } /** - * Set logger instance - * - * @param object $logger - */ + * Set logger instance + * + * @param object $logger + */ public function setLogger($logger) { $this->logger = $logger; } /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function getResponseBody() { return $this->responseBody; } /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function getResponseHeader() { return $this->responseHeader; } /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function getResponseHttpCode() { return $this->responseHttpCode; } /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function getResponseClientError() { return $this->responseClientError; } /** - * @return array - */ + * @return array + */ protected function getResponseClientInfo() { return $this->responseClientInfo; } /** - * Returns method request() arguments - * - * This is used for debugging. - * - * @return array - */ + * Returns method request() arguments + * + * This is used for debugging. + * + * @return array + */ protected function getRequestArguments() { return $this->requestArguments; } /** - * Fetch server response headers - * - * @param mixed $curl - * @param string $header - * - * @return integer - */ + * Fetch server response headers + * + * @param mixed $curl + * @param string $header + * + * @return int + */ protected function fetchResponseHeader($curl, $header) { $pos = strpos($header, ':'); - if (! empty($pos)) { - $key = str_replace('-', '_', strtolower(substr($header, 0, $pos))); + if (!empty($pos)) { + $key = str_replace('-', '_', strtolower(substr($header, 0, $pos))); $value = trim(substr($header, $pos + 2)); - $this->responseHeader[ $key ] = $value; + $this->responseHeader[$key] = $value; } return strlen($header); } /** - * Convert request headers to the expect curl format - * - * @return array - */ + * Convert request headers to the expect curl format + * + * @return array + */ protected function prepareRequestHeaders() { $headers = []; foreach ($this->requestHeader as $header => $value) { - $headers[] = trim($header) .': '. trim($value); + $headers[] = trim($header) . ': ' . trim($value); } return $headers; diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/HttpClient/Guzzle.php b/e107_handlers/vendor/hybridauth/hybridauth/src/HttpClient/Guzzle.php index 9d77dc7cf..758b96e70 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/HttpClient/Guzzle.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/HttpClient/Guzzle.php @@ -13,20 +13,20 @@ use GuzzleHttp\Exception\ServerException; use GuzzleHttp\Exception\TransferException; /** - * HybridAuth Guzzle Http client + * Hybridauth Guzzle Http client * * Note: This is just a proof of concept. Feel free to improve it. * * Example: * * - * $guzzle = new Hybridauth\HttpClient\Guzzle( new GuzzleHttp\Client(), [ - * 'verify' => '/path/to/your/certificate.crt', - * 'headers' => [ 'User-Agent' => '..' ] + * $guzzle = new Hybridauth\HttpClient\Guzzle(new GuzzleHttp\Client(), [ + * 'verify' => '/path/to/your/certificate.crt', + * 'headers' => ['User-Agent' => '..'] * // 'proxy' => ... * ]); * - * $adapter = new Hybridauth\Provider\Github( $config, $guzzle ); + * $adapter = new Hybridauth\Provider\Github($config, $guzzle); * * $adapter->authenticate(); * @@ -34,73 +34,73 @@ use GuzzleHttp\Exception\TransferException; class Guzzle implements HttpClientInterface { /** - * Method request() arguments - * - * This is used for debugging. - * - * @var array - */ + * Method request() arguments + * + * This is used for debugging. + * + * @var array + */ protected $requestArguments = []; /** - * Default request headers - * - * @var array - */ + * Default request headers + * + * @var array + */ protected $requestHeader = []; /** - * Raw response returned by server - * - * @var string - */ + * Raw response returned by server + * + * @var string + */ protected $responseBody = ''; /** - * Headers returned in the response - * - * @var array - */ + * Headers returned in the response + * + * @var array + */ protected $responseHeader = []; /** - * Response HTTP status code - * - * @var integer - */ + * Response HTTP status code + * + * @var int + */ protected $responseHttpCode = 0; /** - * Last curl error number - * - * @var mixed - */ + * Last curl error number + * + * @var mixed + */ protected $responseClientError = null; /** - * Information about the last transfer - * - * @var mixed - */ + * Information about the last transfer + * + * @var mixed + */ protected $responseClientInfo = []; /** - * Hybridauth logger instance - * - * @var object - */ + * Hybridauth logger instance + * + * @var object + */ protected $logger = null; /** - * GuzzleHttp client - * - * @var \GuzzleHttp\Client - */ + * GuzzleHttp client + * + * @var \GuzzleHttp\Client + */ protected $client = null; /** * .. - * @param null $client + * @param null $client * @param array $config */ public function __construct($client = null, $config = []) @@ -109,11 +109,11 @@ class Guzzle implements HttpClientInterface } /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function request($uri, $method = 'GET', $parameters = [], $headers = [], $multipart = false) { - $this->requestHeader = array_replace($this->requestHeader, (array) $headers); + $this->requestHeader = array_replace($this->requestHeader, (array)$headers); $this->requestArguments = [ 'uri' => $uri, @@ -129,8 +129,8 @@ class Guzzle implements HttpClientInterface case 'GET': case 'DELETE': $response = $this->client->request($method, $uri, [ - 'query' => $parameters, - 'headers' => $this->requestHeader, + 'query' => $parameters, + 'headers' => $this->requestHeader, ]); break; case 'PUT': @@ -171,9 +171,9 @@ class Guzzle implements HttpClientInterface } if (!$this->responseClientError) { - $this->responseBody = $response->getBody(); + $this->responseBody = $response->getBody(); $this->responseHttpCode = $response->getStatusCode(); - $this->responseHeader = $response->getHeaders(); + $this->responseHeader = $response->getHeaders(); } if ($this->logger) { @@ -190,82 +190,82 @@ class Guzzle implements HttpClientInterface } /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function getResponse() { return [ 'request' => $this->getRequestArguments(), 'response' => [ - 'code' => $this->getResponseHttpCode(), + 'code' => $this->getResponseHttpCode(), 'headers' => $this->getResponseHeader(), - 'body' => $this->getResponseBody(), + 'body' => $this->getResponseBody(), ], 'client' => [ 'error' => $this->getResponseClientError(), - 'info' => $this->getResponseClientInfo(), - 'opts' => null, + 'info' => $this->getResponseClientInfo(), + 'opts' => null, ], ]; } /** - * Set logger instance - * - * @param object $logger - */ + * Set logger instance + * + * @param object $logger + */ public function setLogger($logger) { $this->logger = $logger; } /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function getResponseBody() { return $this->responseBody; } /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function getResponseHeader() { return $this->responseHeader; } /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function getResponseHttpCode() { return $this->responseHttpCode; } /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function getResponseClientError() { return $this->responseClientError; } /** - * @return array - */ + * @return array + */ protected function getResponseClientInfo() { return $this->responseClientInfo; } /** - * Returns method request() arguments - * - * This is used for debugging. - * - * @return array - */ + * Returns method request() arguments + * + * This is used for debugging. + * + * @return array + */ protected function getRequestArguments() { return $this->requestArguments; diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/HttpClient/HttpClientInterface.php b/e107_handlers/vendor/hybridauth/hybridauth/src/HttpClient/HttpClientInterface.php index 7644f0925..46598d1f1 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/HttpClient/HttpClientInterface.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/HttpClient/HttpClientInterface.php @@ -8,51 +8,51 @@ namespace Hybridauth\HttpClient; /** - * HybridAuth Http clients interface + * Hybridauth Http clients interface */ interface HttpClientInterface { /** - * Send request to the remote server - * - * Returns the result (Raw response from the server) on success, FALSE on failure - * - * @param string $uri - * @param string $method - * @param array $parameters - * @param array $headers - * @param bool $multipart - * - * @return mixed - */ + * Send request to the remote server + * + * Returns the result (Raw response from the server) on success, FALSE on failure + * + * @param string $uri + * @param string $method + * @param array $parameters + * @param array $headers + * @param bool $multipart + * + * @return mixed + */ public function request($uri, $method = 'GET', $parameters = [], $headers = [], $multipart = false); /** - * Returns raw response from the server on success, FALSE on failure - * - * @return mixed - */ + * Returns raw response from the server on success, FALSE on failure + * + * @return mixed + */ public function getResponseBody(); /** - * Retriever the headers returned in the response - * - * @return array - */ + * Retriever the headers returned in the response + * + * @return array + */ public function getResponseHeader(); /** - * Returns latest request HTTP status code - * - * @return integer - */ + * Returns latest request HTTP status code + * + * @return int + */ public function getResponseHttpCode(); /** - * Returns latest error encountered by the client - * This can be either a code or error message - * - * @return mixed - */ + * Returns latest error encountered by the client + * This can be either a code or error message + * + * @return mixed + */ public function getResponseClientError(); } diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/HttpClient/Util.php b/e107_handlers/vendor/hybridauth/hybridauth/src/HttpClient/Util.php index e83c07842..1a92f7e2c 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/HttpClient/Util.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/HttpClient/Util.php @@ -15,17 +15,17 @@ use Hybridauth\Data; class Util { /** - * Redirect handler. - * - * @var callable|null - */ + * Redirect handler. + * + * @var callable|null + */ protected static $redirectHandler; /** - * Exit handler. - * - * @var callable|null - */ + * Exit handler. + * + * @var callable|null + */ protected static $exitHandler; /** @@ -56,32 +56,32 @@ class Util } /** - * Redirect handler to which the regular redirect() will yield the action of redirecting users. - * - * @param callable $callback - */ + * Redirect handler to which the regular redirect() will yield the action of redirecting users. + * + * @param callable $callback + */ public static function setRedirectHandler($callback) { self::$redirectHandler = $callback; } /** - * Exit handler will be called instead of regular exit() when calling Util::redirect() method. - * - * @param callable $callback - */ + * Exit handler will be called instead of regular exit() when calling Util::redirect() method. + * + * @param callable $callback + */ public static function setExitHandler($callback) { self::$exitHandler = $callback; } /** - * Returns the Current URL. - * - * @param bool $requestUri TRUE to use $_SERVER['REQUEST_URI'], FALSE for $_SERVER['PHP_SELF'] - * - * @return string - */ + * Returns the Current URL. + * + * @param bool $requestUri TRUE to use $_SERVER['REQUEST_URI'], FALSE for $_SERVER['PHP_SELF'] + * + * @return string + */ public static function getCurrentUrl($requestUri = false) { $collection = new Data\Collection($_SERVER); @@ -93,8 +93,8 @@ class Util $protocol = 'https://'; } - return $protocol. - $collection->get('HTTP_HOST'). - $collection->get($requestUri ? 'REQUEST_URI' : 'PHP_SELF'); + return $protocol . + $collection->get('HTTP_HOST') . + $collection->get($requestUri ? 'REQUEST_URI' : 'PHP_SELF'); } } diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Hybridauth.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Hybridauth.php index 799a2213a..0dc96c119 100755 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Hybridauth.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Hybridauth.php @@ -25,41 +25,41 @@ use Hybridauth\HttpClient\HttpClientInterface; class Hybridauth { /** - * Hybridauth config. - * - * @var array - */ + * Hybridauth config. + * + * @var array + */ protected $config; /** - * Storage. - * - * @var StorageInterface - */ + * Storage. + * + * @var StorageInterface + */ protected $storage; /** - * HttpClient. - * - * @var HttpClientInterface - */ + * HttpClient. + * + * @var HttpClientInterface + */ protected $httpClient; /** - * Logger. - * - * @var LoggerInterface - */ + * Logger. + * + * @var LoggerInterface + */ protected $logger; /** - * @param array|string $config Array with configuration or Path to PHP file that will return array - * @param HttpClientInterface $httpClient - * @param StorageInterface $storage - * @param LoggerInterface $logger - * - * @throws InvalidArgumentException - */ + * @param array|string $config Array with configuration or Path to PHP file that will return array + * @param HttpClientInterface $httpClient + * @param StorageInterface $storage + * @param LoggerInterface $logger + * + * @throws InvalidArgumentException + */ public function __construct( $config, HttpClientInterface $httpClient = null, @@ -68,34 +68,34 @@ class Hybridauth ) { if (is_string($config) && file_exists($config)) { $config = include $config; - } elseif (! is_array($config)) { + } elseif (!is_array($config)) { throw new InvalidArgumentException('Hybridauth config does not exist on the given path.'); } $this->config = $config + [ - 'debug_mode' => Logger::NONE, - 'debug_file' => '', - 'curl_options' => null, - 'providers' => [] - ]; + 'debug_mode' => Logger::NONE, + 'debug_file' => '', + 'curl_options' => null, + 'providers' => [] + ]; $this->storage = $storage; $this->logger = $logger; $this->httpClient = $httpClient; } /** - * Instantiate the given provider and authentication or authorization protocol. - * - * If not authenticated yet, the user will be redirected to the provider's site for - * authentication/authorisation, otherwise it will simply return an instance of - * provider's adapter. - * - * @param string $name adapter's name (case insensitive) - * - * @return \Hybridauth\Adapter\AdapterInterface - * @throws InvalidArgumentException - * @throws UnexpectedValueException - */ + * Instantiate the given provider and authentication or authorization protocol. + * + * If not authenticated yet, the user will be redirected to the provider's site for + * authentication/authorisation, otherwise it will simply return an instance of + * provider's adapter. + * + * @param string $name adapter's name (case insensitive) + * + * @return \Hybridauth\Adapter\AdapterInterface + * @throws InvalidArgumentException + * @throws UnexpectedValueException + */ public function authenticate($name) { $adapter = $this->getAdapter($name); @@ -106,14 +106,14 @@ class Hybridauth } /** - * Returns a new instance of a provider's adapter by name - * - * @param string $name adapter's name (case insensitive) - * - * @return \Hybridauth\Adapter\AdapterInterface - * @throws InvalidArgumentException - * @throws UnexpectedValueException - */ + * Returns a new instance of a provider's adapter by name + * + * @param string $name adapter's name (case insensitive) + * + * @return \Hybridauth\Adapter\AdapterInterface + * @throws InvalidArgumentException + * @throws UnexpectedValueException + */ public function getAdapter($name) { $config = $this->getProviderConfig($name); @@ -142,26 +142,26 @@ class Hybridauth } /** - * Get provider config by name. - * - * @param string $name adapter's name (case insensitive) - * - * @throws UnexpectedValueException - * @throws InvalidArgumentException - * - * @return array - */ + * Get provider config by name. + * + * @param string $name adapter's name (case insensitive) + * + * @throws UnexpectedValueException + * @throws InvalidArgumentException + * + * @return array + */ public function getProviderConfig($name) { $name = strtolower($name); $providersConfig = array_change_key_case($this->config['providers'], CASE_LOWER); - if (! isset($providersConfig[$name])) { + if (!isset($providersConfig[$name])) { throw new InvalidArgumentException('Unknown Provider.'); } - if (! $providersConfig[$name]['enabled']) { + if (!$providersConfig[$name]['enabled']) { throw new UnexpectedValueException('Disabled Provider.'); } @@ -171,7 +171,7 @@ class Hybridauth 'debug_file' => $this->config['debug_file'], ]; - if (! isset($config['callback']) && isset($this->config['callback'])) { + if (!isset($config['callback']) && isset($this->config['callback'])) { $config['callback'] = $this->config['callback']; } @@ -179,24 +179,24 @@ class Hybridauth } /** - * Returns a boolean of whether the user is connected with a provider - * - * @param string $name adapter's name (case insensitive) - * - * @return boolean - * @throws InvalidArgumentException - * @throws UnexpectedValueException - */ + * Returns a boolean of whether the user is connected with a provider + * + * @param string $name adapter's name (case insensitive) + * + * @return bool + * @throws InvalidArgumentException + * @throws UnexpectedValueException + */ public function isConnectedWith($name) { return $this->getAdapter($name)->isConnected(); } /** - * Returns a list of enabled adapters names - * - * @return array - */ + * Returns a list of enabled adapters names + * + * @return array + */ public function getProviders() { $providers = []; @@ -211,19 +211,19 @@ class Hybridauth } /** - * Returns a list of currently connected adapters names - * - * @return array - * @throws InvalidArgumentException - * @throws UnexpectedValueException - */ + * Returns a list of currently connected adapters names + * + * @return array + * @throws InvalidArgumentException + * @throws UnexpectedValueException + */ public function getConnectedProviders() { $providers = []; foreach ($this->getProviders() as $name) { if ($this->isConnectedWith($name)) { - $providers[] = $name; + $providers[] = $name; } } @@ -231,12 +231,12 @@ class Hybridauth } /** - * Returns a list of new instances of currently connected adapters - * - * @return \Hybridauth\Adapter\AdapterInterface[] - * @throws InvalidArgumentException - * @throws UnexpectedValueException - */ + * Returns a list of new instances of currently connected adapters + * + * @return \Hybridauth\Adapter\AdapterInterface[] + * @throws InvalidArgumentException + * @throws UnexpectedValueException + */ public function getConnectedAdapters() { $adapters = []; @@ -253,8 +253,8 @@ class Hybridauth } /** - * Disconnect all currently connected adapters at once - */ + * Disconnect all currently connected adapters at once + */ public function disconnectAllAdapters() { foreach ($this->getProviders() as $name) { diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Logger/Logger.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Logger/Logger.php index 6b568be21..92d5d2fb6 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Logger/Logger.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Logger/Logger.php @@ -15,9 +15,9 @@ use Hybridauth\Exception\InvalidArgumentException; */ class Logger implements LoggerInterface { - const NONE = 'none'; // turn logging off + const NONE = 'none'; // turn logging off const DEBUG = 'debug'; // debug, info and error messages - const INFO = 'info'; // info and error messages + const INFO = 'info'; // info and error messages const ERROR = 'error'; // only error messages /** @@ -38,7 +38,7 @@ class Logger implements LoggerInterface /** * @param bool|string $level One of Logger::NONE, Logger::DEBUG, Logger::INFO, Logger::ERROR - * @param string $file File where to write messages + * @param string $file File where to write messages * * @throws InvalidArgumentException * @throws RuntimeException @@ -50,7 +50,7 @@ class Logger implements LoggerInterface if ($level && $level !== self::NONE) { $this->initialize($file); - $this->level = $level === true ? Logger::DEBUG : $level; + $this->level = $level === true ? Logger::DEBUG : $level; $this->file = $file; } } @@ -121,7 +121,7 @@ class Logger implements LoggerInterface $datetime = $datetime->format(DATE_ATOM); $content = sprintf('%s -- %s -- %s -- %s', $level, $_SERVER['REMOTE_ADDR'], $datetime, $message); - $content .= ($context ? "\n".print_r($context, true) : ''); + $content .= ($context ? "\n" . print_r($context, true) : ''); $content .= "\n"; file_put_contents($this->file, $content, FILE_APPEND); diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Logger/LoggerInterface.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Logger/LoggerInterface.php index 78b748d3c..84059fa6f 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Logger/LoggerInterface.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Logger/LoggerInterface.php @@ -18,7 +18,7 @@ interface LoggerInterface * Example: User logs in, SQL logs. * * @param string $message - * @param array $context + * @param array $context */ public function info($message, array $context = array()); @@ -26,7 +26,7 @@ interface LoggerInterface * Detailed debug information. * * @param string $message - * @param array $context + * @param array $context */ public function debug($message, array $context = array()); @@ -35,16 +35,16 @@ interface LoggerInterface * be logged and monitored. * * @param string $message - * @param array $context + * @param array $context */ public function error($message, array $context = array()); /** * Logs with an arbitrary level. * - * @param mixed $level + * @param mixed $level * @param string $message - * @param array $context + * @param array $context */ public function log($level, $message, array $context = array()); } diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/AOLOpenID.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/AOLOpenID.php index bbf931cfc..2af1785ea 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/AOLOpenID.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/AOLOpenID.php @@ -7,15 +7,20 @@ namespace Hybridauth\Provider; -use Hybridauth\Adapter\OpenID as OpenIDAdapter; +use Hybridauth\Adapter\OpenID; /** * AOL OpenID provider adapter. */ -class AOLOpenID extends OpenIDAdapter +class AOLOpenID extends OpenID { /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $openidIdentifier = 'http://openid.aol.com/'; + + /** + * {@inheritdoc} + */ + protected $apiDocumentation = ''; // Not available } diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Amazon.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Amazon.php index 2c0ab87e8..2008d73fe 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Amazon.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Amazon.php @@ -20,7 +20,7 @@ class Amazon extends OAuth2 /** * {@inheritdoc} */ - public $scope = 'profile'; + protected $scope = 'profile'; /** * {@inheritdoc} @@ -57,9 +57,9 @@ class Amazon extends OAuth2 $userProfile = new User\Profile(); - $userProfile->identifier = $data->get('user_id'); + $userProfile->identifier = $data->get('user_id'); $userProfile->displayName = $data->get('name'); - $userProfile->email = $data->get('email'); + $userProfile->email = $data->get('email'); return $userProfile; } diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Authentiq.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Authentiq.php index b41617ffe..685c044cc 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Authentiq.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Authentiq.php @@ -18,33 +18,33 @@ use Hybridauth\User; class Authentiq extends OAuth2 { /** - * {@inheritdoc} - */ - public $scope = 'aq:name email~rs aq:push openid'; + * {@inheritdoc} + */ + protected $scope = 'aq:name email~rs aq:push openid'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $apiBaseUrl = 'https://connect.authentiq.io/'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $authorizeUrl = 'https://connect.authentiq.io/authorize'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $accessTokenUrl = 'https://connect.authentiq.io/token'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $apiDocumentation = 'http://developers.authentiq.io/'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected function initialize() { parent::initialize(); @@ -54,26 +54,17 @@ class Authentiq extends OAuth2 ]; $this->tokenExchangeHeaders = [ - 'Authorization' => 'Basic ' . base64_encode($this->clientId . ':' . $this->clientSecret) + 'Authorization' => 'Basic ' . base64_encode($this->clientId . ':' . $this->clientSecret) ]; $this->tokenRefreshHeaders = [ - 'Authorization' => 'Basic ' . base64_encode($this->clientId . ':' . $this->clientSecret) + 'Authorization' => 'Basic ' . base64_encode($this->clientId . ':' . $this->clientSecret) ]; } /** - * {@inheritdoc} - * - * Disable functionality as Authentiq Provider doesn't support this yet - */ - public function refreshAccessToken($parameters = []) - { - } - - /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function getUserProfile() { $response = $this->apiRequest('userinfo'); @@ -81,39 +72,39 @@ class Authentiq extends OAuth2 $data = new Data\Collection($response); if (!$data->exists('sub')) { - throw new UnexpectedValueException('Provider API returned an unexpected response.'); + throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); } $userProfile = new User\Profile(); - $userProfile->identifier = $data->get('sub'); + $userProfile->identifier = $data->get('sub'); $userProfile->displayName = $data->get('name'); - $userProfile->firstName = $data->get('given_name'); + $userProfile->firstName = $data->get('given_name'); // $userProfile->middleName = $data->get('middle_name'); // not supported - $userProfile->lastName = $data->get('family_name'); + $userProfile->lastName = $data->get('family_name'); if (!empty($userProfile->displayName)) { $userProfile->displayName = join(' ', array($userProfile->firstName, - // $userProfile->middleName, - $userProfile->lastName)); + // $userProfile->middleName, + $userProfile->lastName)); } - $userProfile->email = $data->get('email'); + $userProfile->email = $data->get('email'); $userProfile->emailVerified = $data->get('email_verified') ? $userProfile->email : ''; - $userProfile->phone = $data->get('phone'); + $userProfile->phone = $data->get('phone'); // $userProfile->phoneVerified = $data->get('phone_verified') ? $userProfile->phone : ''; // not supported - $userProfile->profileURL = $data->get('profile'); - $userProfile->webSiteURL = $data->get('website'); - $userProfile->photoURL = $data->get('picture'); - $userProfile->gender = $data->get('gender'); - $userProfile->address = $data->filter('address')->get('street_address'); - $userProfile->city = $data->filter('address')->get('locality'); - $userProfile->country = $data->filter('address')->get('country'); - $userProfile->region = $data->filter('address')->get('region'); - $userProfile->zip = $data->filter('address')->get('postal_code'); + $userProfile->profileURL = $data->get('profile'); + $userProfile->webSiteURL = $data->get('website'); + $userProfile->photoURL = $data->get('picture'); + $userProfile->gender = $data->get('gender'); + $userProfile->address = $data->filter('address')->get('street_address'); + $userProfile->city = $data->filter('address')->get('locality'); + $userProfile->country = $data->filter('address')->get('country'); + $userProfile->region = $data->filter('address')->get('region'); + $userProfile->zip = $data->filter('address')->get('postal_code'); return $userProfile; } diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/BitBucket.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/BitBucket.php index 1c9241c64..7fbe094ce 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/BitBucket.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/BitBucket.php @@ -12,62 +12,67 @@ use Hybridauth\Exception\UnexpectedApiResponseException; use Hybridauth\Data; use Hybridauth\User; +/** + * Set up your OAuth2 at https://bitbucket.org//workspace/settings/api + */ + /** * BitBucket OAuth2 provider adapter. */ class BitBucket extends OAuth2 { /** - * {@inheritdoc} - */ - public $scope = 'email'; + * {@inheritdoc} + */ + protected $scope = 'email'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $apiBaseUrl = 'https://api.bitbucket.org/2.0/'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $authorizeUrl = 'https://bitbucket.org/site/oauth2/authorize'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $accessTokenUrl = 'https://bitbucket.org/site/oauth2/access_token'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $apiDocumentation = 'https://developer.atlassian.com/bitbucket/concepts/oauth2.html'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function getUserProfile() { $response = $this->apiRequest('user'); $data = new Data\Collection($response); - if (! $data->exists('uuid')) { + if (!$data->exists('uuid')) { throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); } $userProfile = new User\Profile(); - $userProfile->identifier = $data->get('uuid'); + $userProfile->identifier = $data->get('uuid'); + $userProfile->profileURL = 'https://bitbucket.org/' . $data->get('username') . '/'; $userProfile->displayName = $data->get('display_name'); - $userProfile->email = $data->get('email'); - $userProfile->webSiteURL = $data->get('website'); - $userProfile->region = $data->get('location'); + $userProfile->email = $data->get('email'); + $userProfile->webSiteURL = $data->get('website'); + $userProfile->region = $data->get('location'); $userProfile->displayName = $userProfile->displayName ?: $data->get('username'); if (empty($userProfile->email) && strpos($this->scope, 'email') !== false) { try { - // user email is not mandatory so keep it quite + // user email is not mandatory so keep it quiet $userProfile = $this->requestUserEmail($userProfile); } catch (\Exception $e) { } @@ -90,10 +95,10 @@ class BitBucket extends OAuth2 $response = $this->apiRequest('user/emails'); foreach ($response->values as $idx => $item) { - if (! empty($item->is_primary) && $item->is_primary == true) { + if (!empty($item->is_primary) && $item->is_primary == true) { $userProfile->email = $item->email; - if (! empty($item->is_confirmed) && $item->is_confirmed == true) { + if (!empty($item->is_confirmed) && $item->is_confirmed == true) { $userProfile->emailVerified = $userProfile->email; } diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Blizzard.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Blizzard.php index a02c06e4e..7f57d95eb 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Blizzard.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Blizzard.php @@ -20,7 +20,7 @@ class Blizzard extends OAuth2 /** * {@inheritdoc} */ - public $scope = ''; + protected $scope = ''; /** * {@inheritdoc} @@ -57,7 +57,7 @@ class Blizzard extends OAuth2 $userProfile = new User\Profile(); - $userProfile->identifier = $data->get('id'); + $userProfile->identifier = $data->get('id'); $userProfile->displayName = $data->get('battletag') ?: $data->get('login'); return $userProfile; diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Discord.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Discord.php index 120f59c5c..d7ca22450 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Discord.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Discord.php @@ -17,11 +17,10 @@ use Hybridauth\User; */ class Discord extends OAuth2 { - /** * {@inheritdoc} */ - public $scope = 'identify email'; + protected $scope = 'identify email'; /** * {@inheritdoc} @@ -50,10 +49,12 @@ class Discord extends OAuth2 { parent::initialize(); - $this->tokenRefreshParameters += [ - 'client_id' => $this->clientId, - 'client_secret' => $this->clientSecret, - ]; + if ($this->isRefreshTokenAvailable()) { + $this->tokenRefreshParameters += [ + 'client_id' => $this->clientId, + 'client_secret' => $this->clientSecret, + ]; + } } /** diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Disqus.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Disqus.php index 271f396bc..5fa7ac03f 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Disqus.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Disqus.php @@ -18,33 +18,33 @@ use Hybridauth\User; class Disqus extends OAuth2 { /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $scope = 'read,email'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $apiBaseUrl = 'https://disqus.com/api/3.0/'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $authorizeUrl = 'https://disqus.com/api/oauth/2.0/authorize'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $accessTokenUrl = 'https://disqus.com/api/oauth/2.0/access_token/'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $apiDocumentation = 'https://disqus.com/api/docs/auth/'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected function initialize() { parent::initialize(); @@ -55,15 +55,15 @@ class Disqus extends OAuth2 } /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function getUserProfile() { $response = $this->apiRequest('users/details'); $data = new Data\Collection($response); - if (! $data->filter('response')->exists('id')) { + if (!$data->filter('response')->exists('id')) { throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); } @@ -71,15 +71,15 @@ class Disqus extends OAuth2 $data = $data->filter('response'); - $userProfile->identifier = $data->get('id'); + $userProfile->identifier = $data->get('id'); $userProfile->displayName = $data->get('name'); $userProfile->description = $data->get('bio'); - $userProfile->profileURL = $data->get('profileUrl'); - $userProfile->email = $data->get('email'); - $userProfile->region = $data->get('location'); + $userProfile->profileURL = $data->get('profileUrl'); + $userProfile->email = $data->get('email'); + $userProfile->region = $data->get('location'); $userProfile->description = $data->get('about'); - $userProfile->photoURL = $data->filter('avatar')->get('permalink'); + $userProfile->photoURL = $data->filter('avatar')->get('permalink'); $userProfile->displayName = $userProfile->displayName ?: $data->get('username'); diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Dribbble.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Dribbble.php index 594ab02a0..4b525184e 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Dribbble.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Dribbble.php @@ -18,50 +18,50 @@ use Hybridauth\User; class Dribbble extends OAuth2 { /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $apiBaseUrl = 'https://api.dribbble.com/v2/'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $authorizeUrl = 'https://dribbble.com/oauth/authorize'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $accessTokenUrl = 'https://dribbble.com/oauth/token'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $apiDocumentation = 'http://developer.dribbble.com/v2/oauth/'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function getUserProfile() { $response = $this->apiRequest('user'); $data = new Data\Collection($response); - if (! $data->exists('id')) { + if (!$data->exists('id')) { throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); } $userProfile = new User\Profile(); - $userProfile->identifier = $data->get('id'); - $userProfile->profileURL = $data->get('html_url'); - $userProfile->photoURL = $data->get('avatar_url'); + $userProfile->identifier = $data->get('id'); + $userProfile->profileURL = $data->get('html_url'); + $userProfile->photoURL = $data->get('avatar_url'); $userProfile->description = $data->get('bio'); - $userProfile->region = $data->get('location'); + $userProfile->region = $data->get('location'); $userProfile->displayName = $data->get('name'); $userProfile->displayName = $userProfile->displayName ?: $data->get('username'); - $userProfile->webSiteURL = $data->filter('links')->get('web'); + $userProfile->webSiteURL = $data->filter('links')->get('web'); return $userProfile; } diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Facebook.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Facebook.php index f0fbf2add..62dbac48f 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Facebook.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Facebook.php @@ -16,15 +16,22 @@ use Hybridauth\User; /** * Facebook OAuth2 provider adapter. * + * Facebook doesn't use standard OAuth refresh tokens. + * Instead it has a "token exchange" system. You exchange the token prior to + * expiry, to push back expiry. You start with a short-lived token and each + * exchange gives you a long-lived one (90 days). + * We control this with the 'exchange_by_expiry_days' option. + * * Example: * * $config = [ * 'callback' => Hybridauth\HttpClient\Util::getCurrentUrl(), - * 'keys' => [ 'id' => '', 'secret' => '' ], - * 'scope' => 'email, user_status, user_posts' + * 'keys' => ['id' => '', 'secret' => ''], + * 'scope' => 'email, user_status, user_posts', + * 'exchange_by_expiry_days' => 45, // null for no token exchange * ]; * - * $adapter = new Hybridauth\Provider\Facebook( $config ); + * $adapter = new Hybridauth\Provider\Facebook($config); * * try { * $adapter->authenticate(); @@ -32,8 +39,7 @@ use Hybridauth\User; * $userProfile = $adapter->getUserProfile(); * $tokens = $adapter->getAccessToken(); * $response = $adapter->setUserStatus("Hybridauth test message.."); - * } - * catch( Exception $e ){ + * } catch (\Exception $e) { * echo $e->getMessage() ; * } */ @@ -47,7 +53,7 @@ class Facebook extends OAuth2 /** * {@inheritdoc} */ - protected $apiBaseUrl = 'https://graph.facebook.com/v6.0/'; + protected $apiBaseUrl = 'https://graph.facebook.com/v8.0/'; /** * {@inheritdoc} @@ -83,6 +89,53 @@ class Facebook extends OAuth2 } } + /** + * {@inheritdoc} + */ + public function apiRequest($url, $method = 'GET', $parameters = [], $headers = [], $multipart = false) + { + // Handle token exchange prior to the standard handler for an API request + $exchange_by_expiry_days = $this->config->get('exchange_by_expiry_days') ?: 45; + if ($exchange_by_expiry_days !== null) { + $projected_timestamp = time() + 60 * 60 * 24 * $exchange_by_expiry_days; + if (!$this->hasAccessTokenExpired() && $this->hasAccessTokenExpired($projected_timestamp)) { + $this->exchangeAccessToken(); + } + } + + return parent::apiRequest($url, $method, $parameters, $headers, $multipart); + } + + /** + * Exchange the Access Token with one that expires further in the future. + * + * @return string Raw Provider API response + * @throws \Hybridauth\Exception\HttpClientFailureException + * @throws \Hybridauth\Exception\HttpRequestFailedException + * @throws InvalidAccessTokenException + */ + public function exchangeAccessToken() + { + $exchangeTokenParameters = [ + 'grant_type' => 'fb_exchange_token', + 'client_id' => $this->clientId, + 'client_secret' => $this->clientSecret, + 'fb_exchange_token' => $this->getStoredData('access_token'), + ]; + + $response = $this->httpClient->request( + $this->accessTokenUrl, + 'GET', + $exchangeTokenParameters + ); + + $this->validateApiResponse('Unable to exchange the access token'); + + $this->validateAccessTokenExchange($response); + + return $response; + } + /** * {@inheritdoc} */ @@ -93,16 +146,28 @@ class Facebook extends OAuth2 'name', 'first_name', 'last_name', - 'link', 'website', - 'gender', 'locale', 'about', 'email', 'hometown', 'birthday', ]; - $response = $this->apiRequest('me?fields=' . implode(',', $fields)); + + if (strpos($this->scope, 'user_link') !== false) { + $fields[] = 'link'; + } + + if (strpos($this->scope, 'user_gender') !== false) { + $fields[] = 'gender'; + } + + // Note that en_US is needed for gender fields to match convention. + $locale = $this->config->get('locale') ?: 'en_US'; + $response = $this->apiRequest('me', 'GET', [ + 'fields' => implode(',', $fields), + 'locale' => $locale, + ]); $data = new Data\Collection($response); @@ -279,8 +344,8 @@ class Facebook extends OAuth2 // Refresh proof for API call. $parameters = $status + [ - 'appsecret_proof' => hash_hmac('sha256', $page->access_token, $this->clientSecret), - ]; + 'appsecret_proof' => hash_hmac('sha256', $page->access_token, $this->clientSecret), + ]; $response = $this->apiRequest("{$pageId}/feed", 'POST', $parameters, $headers); diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Foursquare.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Foursquare.php index 80d7c4ee2..67556fefc 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Foursquare.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Foursquare.php @@ -18,33 +18,33 @@ use Hybridauth\User; class Foursquare extends OAuth2 { /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $apiBaseUrl = 'https://api.foursquare.com/v2/'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $authorizeUrl = 'https://foursquare.com/oauth2/authenticate'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $accessTokenUrl = 'https://foursquare.com/oauth2/access_token'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $accessTokenName = 'oauth_token'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $apiDocumentation = 'https://developer.foursquare.com/overview/auth'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected function initialize() { parent::initialize(); @@ -58,15 +58,15 @@ class Foursquare extends OAuth2 } /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function getUserProfile() { $response = $this->apiRequest('users/self'); $data = new Data\Collection($response); - if (! $data->exists('response')) { + if (!$data->exists('response')) { throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); } @@ -74,15 +74,15 @@ class Foursquare extends OAuth2 $data = $data->filter('response')->filter('user'); - $userProfile->identifier = $data->get('id'); - $userProfile->firstName = $data->get('firstName'); - $userProfile->lastName = $data->get('lastName'); - $userProfile->gender = $data->get('gender'); - $userProfile->city = $data->get('homeCity'); - $userProfile->email = $data->filter('contact')->get('email'); + $userProfile->identifier = $data->get('id'); + $userProfile->firstName = $data->get('firstName'); + $userProfile->lastName = $data->get('lastName'); + $userProfile->gender = $data->get('gender'); + $userProfile->city = $data->get('homeCity'); + $userProfile->email = $data->filter('contact')->get('email'); $userProfile->emailVerified = $userProfile->email; - $userProfile->profileURL = 'https://www.foursquare.com/user/' . $userProfile->identifier; - $userProfile->displayName = trim($userProfile->firstName . ' ' . $userProfile->lastName); + $userProfile->profileURL = 'https://www.foursquare.com/user/' . $userProfile->identifier; + $userProfile->displayName = trim($userProfile->firstName . ' ' . $userProfile->lastName); if ($data->exists('photo')) { $photoSize = $this->config->get('photo_size') ?: '150x150'; @@ -95,15 +95,15 @@ class Foursquare extends OAuth2 } /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function getUserContacts() { $response = $this->apiRequest('users/self/friends'); $data = new Data\Collection($response); - if (! $data->exists('response')) { + if (!$data->exists('response')) { throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); } diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/GitHub.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/GitHub.php index 1a20b8f78..15b29f701 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/GitHub.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/GitHub.php @@ -17,11 +17,10 @@ use Hybridauth\User; */ class GitHub extends OAuth2 { - /** * {@inheritdoc} */ - public $scope = 'user:email'; + protected $scope = 'user:email'; /** * {@inheritdoc} diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/GitLab.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/GitLab.php index 0a7399bcc..bf98f50f2 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/GitLab.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/GitLab.php @@ -18,52 +18,52 @@ use Hybridauth\User; class GitLab extends OAuth2 { /** - * {@inheritdoc} - */ - public $scope = 'api'; + * {@inheritdoc} + */ + protected $scope = 'api'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $apiBaseUrl = 'https://gitlab.com/api/v3/'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $authorizeUrl = 'https://gitlab.com/oauth/authorize'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $accessTokenUrl = 'https://gitlab.com/oauth/token'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $apiDocumentation = 'https://docs.gitlab.com/ee/api/oauth2.html'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function getUserProfile() { $response = $this->apiRequest('user'); $data = new Data\Collection($response); - if (! $data->exists('id')) { + if (!$data->exists('id')) { throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); } $userProfile = new User\Profile(); - $userProfile->identifier = $data->get('id'); + $userProfile->identifier = $data->get('id'); $userProfile->displayName = $data->get('name'); $userProfile->description = $data->get('bio'); - $userProfile->photoURL = $data->get('avatar_url'); - $userProfile->profileURL = $data->get('web_url'); - $userProfile->email = $data->get('email'); - $userProfile->webSiteURL = $data->get('website_url'); + $userProfile->photoURL = $data->get('avatar_url'); + $userProfile->profileURL = $data->get('web_url'); + $userProfile->email = $data->get('email'); + $userProfile->webSiteURL = $data->get('website_url'); $userProfile->displayName = $userProfile->displayName ?: $data->get('username'); diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Google.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Google.php index 203fe0a47..26b2acbf8 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Google.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Google.php @@ -19,20 +19,20 @@ use Hybridauth\User; * * $config = [ * 'callback' => Hybridauth\HttpClient\Util::getCurrentUrl(), - * 'keys' => [ 'id' => '', 'secret' => '' ], - * 'scope' => 'https://www.googleapis.com/auth/userinfo.profile', + * 'keys' => ['id' => '', 'secret' => ''], + * 'scope' => 'https://www.googleapis.com/auth/userinfo.profile', * * // google's custom auth url params * 'authorize_url_parameters' => [ * 'approval_prompt' => 'force', // to pass only when you need to acquire a new refresh token. - * 'access_type' => .., // is set to 'offline' by default - * 'hd' => .., - * 'state' => .., + * 'access_type' => .., // is set to 'offline' by default + * 'hd' => .., + * 'state' => .., * // etc. * ] * ]; * - * $adapter = new Hybridauth\Provider\Google( $config ); + * $adapter = new Hybridauth\Provider\Google($config); * * try { * $adapter->authenticate(); @@ -40,41 +40,41 @@ use Hybridauth\User; * $userProfile = $adapter->getUserProfile(); * $tokens = $adapter->getAccessToken(); * $contacts = $adapter->getUserContacts(['max-results' => 75]); - * } - * catch( Exception $e ){ + * } catch (\Exception $e) { * echo $e->getMessage() ; * } */ class Google extends OAuth2 { /** - * {@inheritdoc} - */ - public $scope = 'https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email'; + * {@inheritdoc} + */ + // phpcs:ignore + protected $scope = 'https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $apiBaseUrl = 'https://www.googleapis.com/'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $authorizeUrl = 'https://accounts.google.com/o/oauth2/auth'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $accessTokenUrl = 'https://accounts.google.com/o/oauth2/token'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $apiDocumentation = 'https://developers.google.com/identity/protocols/OAuth2'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected function initialize() { parent::initialize(); @@ -83,38 +83,40 @@ class Google extends OAuth2 'access_type' => 'offline' ]; - $this->tokenRefreshParameters += [ - 'client_id' => $this->clientId, - 'client_secret' => $this->clientSecret - ]; + if ($this->isRefreshTokenAvailable()) { + $this->tokenRefreshParameters += [ + 'client_id' => $this->clientId, + 'client_secret' => $this->clientSecret + ]; + } } /** - * {@inheritdoc} - * - * See: https://developers.google.com/identity/protocols/OpenIDConnect#obtainuserinfo - */ + * {@inheritdoc} + * + * See: https://developers.google.com/identity/protocols/OpenIDConnect#obtainuserinfo + */ public function getUserProfile() { $response = $this->apiRequest('oauth2/v3/userinfo'); $data = new Data\Collection($response); - if (! $data->exists('sub')) { + if (!$data->exists('sub')) { throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); } $userProfile = new User\Profile(); - $userProfile->identifier = $data->get('sub'); - $userProfile->firstName = $data->get('given_name'); - $userProfile->lastName = $data->get('family_name'); + $userProfile->identifier = $data->get('sub'); + $userProfile->firstName = $data->get('given_name'); + $userProfile->lastName = $data->get('family_name'); $userProfile->displayName = $data->get('name'); - $userProfile->photoURL = $data->get('picture'); - $userProfile->profileURL = $data->get('profile'); - $userProfile->gender = $data->get('gender'); - $userProfile->language = $data->get('locale'); - $userProfile->email = $data->get('email'); + $userProfile->photoURL = $data->get('picture'); + $userProfile->profileURL = $data->get('profile'); + $userProfile->gender = $data->get('gender'); + $userProfile->language = $data->get('locale'); + $userProfile->email = $data->get('email'); $userProfile->emailVerified = $data->get('email_verified') ? $userProfile->email : ''; @@ -126,8 +128,8 @@ class Google extends OAuth2 } /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function getUserContacts($parameters = []) { $parameters = ['max-results' => 500] + $parameters; @@ -152,11 +154,11 @@ class Google extends OAuth2 protected function getGmailContacts($parameters = []) { $url = 'https://www.google.com/m8/feeds/contacts/default/full?' - . http_build_query(array_replace([ 'alt' => 'json', 'v' => '3.0' ], (array)$parameters)); + . http_build_query(array_replace(['alt' => 'json', 'v' => '3.0'], (array)$parameters)); $response = $this->apiRequest($url); - if (! $response) { + if (!$response) { return []; } @@ -167,11 +169,11 @@ class Google extends OAuth2 $uc = new User\Contact(); $uc->email = isset($entry->{'gd$email'}[0]->address) - ? (string) $entry->{'gd$email'}[0]->address - : ''; + ? (string)$entry->{'gd$email'}[0]->address + : ''; - $uc->displayName = isset($entry->title->{'$t'}) ? (string) $entry->title->{'$t'} : ''; - $uc->identifier = ($uc->email != '') ? $uc->email : ''; + $uc->displayName = isset($entry->title->{'$t'}) ? (string)$entry->title->{'$t'} : ''; + $uc->identifier = ($uc->email != '') ? $uc->email : ''; $uc->description = ''; if (property_exists($response, 'website')) { diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/LinkedIn.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/LinkedIn.php index a873b1855..1165016f1 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/LinkedIn.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/LinkedIn.php @@ -20,7 +20,7 @@ class LinkedIn extends OAuth2 /** * {@inheritdoc} */ - public $scope = 'r_liteprofile r_emailaddress w_member_social'; + protected $scope = 'r_liteprofile r_emailaddress w_member_social'; /** * {@inheritdoc} @@ -55,8 +55,8 @@ class LinkedIn extends OAuth2 ]; - $response = $this->apiRequest('me?projection=(' . implode(',', $fields) . ')'); - $data = new Data\Collection($response); + $response = $this->apiRequest('me', 'GET', ['projection' => '(' . implode(',', $fields) . ')']); + $data = new Data\Collection($response); if (!$data->exists('id')) { throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); @@ -66,14 +66,14 @@ class LinkedIn extends OAuth2 // Handle localized names. $userProfile->firstName = $data - ->filter('firstName') - ->filter('localized') - ->get($this->getPreferredLocale($data, 'firstName')); + ->filter('firstName') + ->filter('localized') + ->get($this->getPreferredLocale($data, 'firstName')); $userProfile->lastName = $data - ->filter('lastName') - ->filter('localized') - ->get($this->getPreferredLocale($data, 'lastName')); + ->filter('lastName') + ->filter('localized') + ->get($this->getPreferredLocale($data, 'lastName')); $userProfile->identifier = $data->get('id'); $userProfile->email = $this->getUserEmail(); @@ -123,8 +123,11 @@ class LinkedIn extends OAuth2 */ public function getUserEmail() { - $response = $this->apiRequest('emailAddress?q=members&projection=(elements*(handle~))'); - $data = new Data\Collection($response); + $response = $this->apiRequest('emailAddress', 'GET', [ + 'q' => 'members', + 'projection' => '(elements*(handle~))', + ]); + $data = new Data\Collection($response); foreach ($data->filter('elements')->toArray() as $element) { $item = new Data\Collection($element); @@ -165,8 +168,8 @@ class LinkedIn extends OAuth2 $headers = [ 'Content-Type' => 'application/json', - 'x-li-format' => 'json', - 'X-Restli-Protocol-Version' => '2.0.0', + 'x-li-format' => 'json', + 'X-Restli-Protocol-Version' => '2.0.0', ]; $response = $this->apiRequest("ugcPosts", 'POST', $status, $headers); diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Mailru.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Mailru.php index 190e93153..f2e4e53bf 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Mailru.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Mailru.php @@ -13,27 +13,7 @@ use Hybridauth\Data\Collection; use Hybridauth\User\Profile; /** - * Mailru provider adapter. - * - * Example: - * - * $config = [ - * 'callback' => Hybridauth\HttpClient\Util::getCurrentUrl(), - * 'keys' => ['id' => '', 'secret' => ''], - * ]; - * - * $adapter = new Hybridauth\Provider\Mailru($config); - * - * try { - * if (!$adapter->isConnected()) { - * $adapter->authenticate(); - * } - * - * $userProfile = $adapter->getUserProfile(); - * } - * catch(\Exception $e) { - * print $e->getMessage() ; - * } + * Mailru OAuth2 provider adapter. */ class Mailru extends OAuth2 { @@ -52,6 +32,10 @@ class Mailru extends OAuth2 */ protected $accessTokenUrl = 'https://connect.mail.ru/oauth/token'; + /** + * {@inheritdoc} + */ + protected $apiDocumentation = ''; // Not available /** * {@inheritdoc} diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/MicrosoftGraph.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/MicrosoftGraph.php index bbd356320..f8e949095 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/MicrosoftGraph.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/MicrosoftGraph.php @@ -13,14 +13,40 @@ use Hybridauth\Exception\UnexpectedApiResponseException; use Hybridauth\User; /** - * Microsoft Graph provider adapter. + * Microsoft Graph OAuth2 provider adapter. + * + * Create an "Azure Active Directory" resource at https://portal.azure.com/ + * (not from the Visual Studio site). + * + * The "Supported account types" choice maps to the 'tenant' setting, see "Authority" @ + * https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-client-application-configuration + * + * Example: + * + * $config = [ + * 'callback' => Hybridauth\HttpClient\Util::getCurrentUrl(), + * 'keys' => ['id' => '', 'secret' => ''], + * 'tenant' => 'user', + * // ^ May be 'common', 'organizations' or 'consumers' or a specific tenant ID or a domain + * ]; + * + * $adapter = new Hybridauth\Provider\MicrosoftGraph($config); + * + * try { + * $adapter->authenticate(); + * + * $userProfile = $adapter->getUserProfile(); + * $tokens = $adapter->getAccessToken(); + * } catch (\Exception $e) { + * echo $e->getMessage() ; + * } */ class MicrosoftGraph extends OAuth2 { /** * {@inheritdoc} */ - public $scope = 'openid user.read contacts.read'; + protected $scope = 'openid user.read contacts.read'; /** * {@inheritdoc} @@ -42,6 +68,24 @@ class MicrosoftGraph extends OAuth2 */ protected $apiDocumentation = 'https://developer.microsoft.com/en-us/graph/docs/concepts/php'; + /** + * {@inheritdoc} + */ + protected function initialize() + { + parent::initialize(); + + $tenant = $this->config->get('tenant'); + if (!empty($tenant)) { + $adjustedEndpoints = [ + 'authorize_url' => str_replace('/common/', '/' . $tenant . '/', $this->authorizeUrl), + 'access_token_url' => str_replace('/common/', '/' . $tenant . '/', $this->accessTokenUrl), + ]; + + $this->setApiEndpoints($adjustedEndpoints); + } + } + /** * {@inheritdoc} */ @@ -57,12 +101,27 @@ class MicrosoftGraph extends OAuth2 $userProfile = new User\Profile(); - $userProfile->identifier = $data->get('id'); - $userProfile->displayName = $data->get('displayName'); - $userProfile->firstName = $data->get('givenName'); - $userProfile->lastName = $data->get('surname'); - $userProfile->email = $data->get('mail'); - $userProfile->language = $data->get('preferredLanguage'); + $userProfile->identifier = $data->get('id'); + $userProfile->displayName = $data->get('displayName'); + $userProfile->firstName = $data->get('givenName'); + $userProfile->lastName = $data->get('surname'); + $userProfile->language = $data->get('preferredLanguage'); + + $userProfile->phone = $data->get('mobilePhone'); + if (empty($userProfile->phone)) { + $businessPhones = $data->get('businessPhones'); + if (isset($businessPhones[0])) { + $userProfile->phone = $businessPhones[0]; + } + } + + $userProfile->email = $data->get('mail'); + if (empty($userProfile->email)) { + $email = $data->get('userPrincipalName'); + if (strpos($email, '@') !== false) { + $userProfile->email = $email; + } + } return $userProfile; } @@ -72,19 +131,19 @@ class MicrosoftGraph extends OAuth2 */ public function getUserContacts() { - $apiUrl = 'me/contacts?$top=50'; + $apiUrl = 'me/contacts?$top=50'; $contacts = []; do { $response = $this->apiRequest($apiUrl); - $data = new Data\Collection($response); + $data = new Data\Collection($response); if (!$data->exists('value')) { throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); } foreach ($data->filter('value')->toArray() as $entry) { $entry = new Data\Collection($entry); - $userContact = new User\Contact(); - $userContact->identifier = $entry->get('id'); + $userContact = new User\Contact(); + $userContact->identifier = $entry->get('id'); $userContact->displayName = $entry->get('displayName'); if (!empty($entry->get('emailAddresses'))) { $userContact->email = $entry->get('emailAddresses')[0]->address; diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/ORCID.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/ORCID.php index 99e5deb7e..78878e68c 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/ORCID.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/ORCID.php @@ -18,28 +18,28 @@ use Hybridauth\User; class ORCID extends OAuth2 { /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $scope = '/authenticate'; - + /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $apiBaseUrl = 'https://pub.orcid.org/v2.1/'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $authorizeUrl = 'https://orcid.org/oauth/authorize'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $accessTokenUrl = 'https://orcid.org/oauth/token'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $apiDocumentation = 'https://members.orcid.org/api/'; /** @@ -53,8 +53,8 @@ class ORCID extends OAuth2 } /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function getUserProfile() { $response = $this->apiRequest($this->getStoredData('orcid') . '/record'); @@ -89,8 +89,8 @@ class ORCID extends OAuth2 { $data = new Data\Collection($data->get('orcid-identifier')); - $profile->identifier = $data->get('path'); - $profile->profileURL = $data->get('uri'); + $profile->identifier = $data->get('path'); + $profile->profileURL = $data->get('uri'); return $profile; } @@ -108,7 +108,7 @@ class ORCID extends OAuth2 $data = new Data\Collection($data->get('person')); $data = new Data\Collection($data->get('biography')); - $profile->description = $data->get('content'); + $profile->description = $data->get('content'); return $profile; } @@ -148,7 +148,7 @@ class ORCID extends OAuth2 { $data = new Data\Collection($data->get('person')); $data = new Data\Collection($data->get('name')); - + if ($data->exists('credit-name')) { $profile->displayName = $data->get('credit-name'); } else { diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Odnoklassniki.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Odnoklassniki.php index cc97dc6e3..14df29830 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Odnoklassniki.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Odnoklassniki.php @@ -14,65 +14,52 @@ use Hybridauth\User; /** * Odnoklassniki OAuth2 provider adapter. - * - * Example: - * - * $config = [ - * 'callback' => Hybridauth\HttpClient\Util::getCurrentUrl(), - * 'keys' => ['id' => '', 'key' => '', 'secret' => ''], - * ]; - - * $adapter = new Hybridauth\Provider\Odnoklassniki($config); - * - * try { - * if (!$adapter->isConnected()) { - * $adapter->authenticate(); - * } - * - * $userProfile = $adapter->getUserProfile(); - * } - * catch(\Exception $e) { - * print $e->getMessage() ; - * } */ class Odnoklassniki extends OAuth2 { /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $apiBaseUrl = 'https://api.ok.ru/'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $authorizeUrl = 'https://connect.ok.ru/oauth/authorize'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $accessTokenUrl = 'https://api.ok.ru/oauth/token.do'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ + protected $apiDocumentation = 'https://apiok.ru/en/ext/oauth/'; + + /** + * {@inheritdoc} + */ protected function initialize() { parent::initialize(); - $this->tokenRefreshParameters += [ - 'client_id' => $this->clientId, - 'client_secret' => $this->clientSecret - ]; + if ($this->isRefreshTokenAvailable()) { + $this->tokenRefreshParameters += [ + 'client_id' => $this->clientId, + 'client_secret' => $this->clientSecret + ]; + } } /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function getUserProfile() { $fields = array( 'uid', 'locale', 'first_name', 'last_name', 'name', 'gender', 'age', 'birthday', - 'has_email', 'current_status', 'current_status_id', 'current_status_date','online', + 'has_email', 'current_status', 'current_status_id', 'current_status_date', 'online', 'photo_id', 'pic_1', 'pic_2', 'pic1024x768', 'location', 'email' ); @@ -84,38 +71,38 @@ class Odnoklassniki extends OAuth2 ); $parameters = [ - 'access_token' => $this->getStoredData('access_token'), + 'access_token' => $this->getStoredData('access_token'), 'application_key' => $this->config->get('keys')['key'], - 'method' => 'users.getCurrentUser', - 'fields' => implode(',', $fields), - 'sig' => $sig, + 'method' => 'users.getCurrentUser', + 'fields' => implode(',', $fields), + 'sig' => $sig, ]; $response = $this->apiRequest('fb.do', 'GET', $parameters); $data = new Data\Collection($response); - if (! $data->exists('uid')) { + if (!$data->exists('uid')) { throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); } $userProfile = new User\Profile(); - $userProfile->identifier = $data->get('uid'); - $userProfile->email = $data->get('email'); - $userProfile->firstName = $data->get('first_name'); - $userProfile->lastName = $data->get('last_name'); + $userProfile->identifier = $data->get('uid'); + $userProfile->email = $data->get('email'); + $userProfile->firstName = $data->get('first_name'); + $userProfile->lastName = $data->get('last_name'); $userProfile->displayName = $data->get('name'); - $userProfile->photoURL = $data->get('pic1024x768'); - $userProfile->profileURL = 'http://ok.ru/profile/' . $data->get('uid'); - + $userProfile->photoURL = $data->get('pic1024x768'); + $userProfile->profileURL = 'http://ok.ru/profile/' . $data->get('uid'); + // Handle birthday. if ($data->get('birthday')) { - $bday = explode('-', $data->get('birthday')); - $userProfile->birthDay = (int)$bday[0]; + $bday = explode('-', $data->get('birthday')); + $userProfile->birthDay = (int)$bday[0]; $userProfile->birthMonth = (int)$bday[1]; - $userProfile->birthYear = (int)$bday[2]; + $userProfile->birthYear = (int)$bday[2]; } return $userProfile; diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/OpenID.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/OpenID.php index aef704ace..d58a30d49 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/OpenID.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/OpenID.php @@ -7,7 +7,7 @@ namespace Hybridauth\Provider; -use Hybridauth\Adapter\OpenID as OpenIDAdapter; +use Hybridauth\Adapter; /** * Generic OpenID providers adapter. @@ -29,17 +29,16 @@ use Hybridauth\Adapter\OpenID as OpenIDAdapter; * // etc. * ]; * - * $adapter = new Hybridauth\Provider\OpenID( $config ); + * $adapter = new Hybridauth\Provider\OpenID($config); * * try { * $adapter->authenticate(); * * $userProfile = $adapter->getUserProfile(); - * } - * catch( \Exception $e ){ + * } catch (\Exception $e) { * echo $e->getMessage() ; * } */ -class OpenID extends OpenIDAdapter +class OpenID extends Adapter\OpenID { } diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Patreon.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Patreon.php index d68006ead..e17411f64 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Patreon.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Patreon.php @@ -17,11 +17,10 @@ use Hybridauth\Data\Collection; */ class Patreon extends OAuth2 { - /** * {@inheritdoc} */ - public $scope = 'identity identity[email]'; + protected $scope = 'identity identity[email]'; /** * {@inheritdoc} @@ -38,6 +37,11 @@ class Patreon extends OAuth2 */ protected $accessTokenUrl = 'https://www.patreon.com/api/oauth2/token'; + /** + * {@inheritdoc} + */ + protected $apiDocumentation = 'https://docs.patreon.com/#oauth'; + /** * {@inheritdoc} */ @@ -45,10 +49,12 @@ class Patreon extends OAuth2 { parent::initialize(); - $this->tokenRefreshParameters += [ - 'client_id' => $this->clientId, - 'client_secret' => $this->clientSecret, - ]; + if ($this->isRefreshTokenAvailable()) { + $this->tokenRefreshParameters += [ + 'client_id' => $this->clientId, + 'client_secret' => $this->clientSecret, + ]; + } } /** diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Paypal.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Paypal.php index b19d1eee1..be6ff423a 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Paypal.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Paypal.php @@ -14,58 +14,37 @@ use Hybridauth\User; /** * Paypal OAuth2 provider adapter. - * - * Example: - * - * $config = [ - * 'callback' => Hybridauth\HttpClient\Util::getCurrentUrl(), - * 'keys' => [ 'id' => '', 'secret' => '' ], - * 'scope' => 'openid profile email', - * ]; - * - * $adapter = new Hybridauth\Provider\Paypal( $config ); - * - * try { - * $adapter->authenticate(); - * - * $userProfile = $adapter->getUserProfile(); - * $tokens = $adapter->getAccessToken(); - * $profile = $adapter->getUserProfile(); - * } - * catch( Exception $e ){ - * echo $e->getMessage() ; - * } */ class Paypal extends OAuth2 { /** - * {@inheritdoc} - */ - public $scope = 'openid profile email address'; + * {@inheritdoc} + */ + protected $scope = 'openid profile email address'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $apiBaseUrl = 'https://api.paypal.com/'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $authorizeUrl = 'https://www.paypal.com/signin/authorize'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $accessTokenUrl = 'https://api.paypal.com/v1/oauth2/token'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $apiDocumentation = 'https://developer.paypal.com/docs/api/overview/#'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected function initialize() { parent::initialize(); @@ -75,20 +54,20 @@ class Paypal extends OAuth2 ]; $this->tokenExchangeHeaders = [ - 'Authorization' => 'Basic ' . base64_encode($this->clientId . ':' . $this->clientSecret) + 'Authorization' => 'Basic ' . base64_encode($this->clientId . ':' . $this->clientSecret) ]; $this->tokenRefreshHeaders = [ - 'Authorization' => 'Basic ' . base64_encode($this->clientId . ':' . $this->clientSecret) + 'Authorization' => 'Basic ' . base64_encode($this->clientId . ':' . $this->clientSecret) ]; } /** - * {@inheritdoc} - * - * See: https://developer.paypal.com/docs/api/identity/v1/ - * See: https://developer.paypal.com/docs/connect-with-paypal/integrate/ - */ + * {@inheritdoc} + * + * See: https://developer.paypal.com/docs/api/identity/v1/ + * See: https://developer.paypal.com/docs/connect-with-paypal/integrate/ + */ public function getUserProfile() { $headers = [ @@ -102,20 +81,20 @@ class Paypal extends OAuth2 $response = $this->apiRequest('v1/identity/oauth2/userinfo', 'GET', $parameters, $headers); $data = new Data\Collection($response); - if (! $data->exists('user_id')) { + if (!$data->exists('user_id')) { throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); } $userProfile = new User\Profile(); - $userProfile->identifier = $data->get('user_id'); - $userProfile->firstName = $data->get('given_name'); - $userProfile->lastName = $data->get('family_name'); + $userProfile->identifier = $data->get('user_id'); + $userProfile->firstName = $data->get('given_name'); + $userProfile->lastName = $data->get('family_name'); $userProfile->displayName = $data->get('name'); - $userProfile->address = $data->filter('address')->get('street_address'); - $userProfile->city = $data->filter('address')->get('locality'); - $userProfile->country = $data->filter('address')->get('country'); - $userProfile->region = $data->filter('address')->get('region'); - $userProfile->zip = $data->filter('address')->get('postal_code'); + $userProfile->address = $data->filter('address')->get('street_address'); + $userProfile->city = $data->filter('address')->get('locality'); + $userProfile->country = $data->filter('address')->get('country'); + $userProfile->region = $data->filter('address')->get('region'); + $userProfile->zip = $data->filter('address')->get('postal_code'); $emails = $data->filter('emails')->toArray(); foreach ($emails as $email) { diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/PaypalOpenID.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/PaypalOpenID.php index fc7720335..9c455f82e 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/PaypalOpenID.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/PaypalOpenID.php @@ -7,27 +7,32 @@ namespace Hybridauth\Provider; -use Hybridauth\Adapter\OpenID as OpenIDAdapter; +use Hybridauth\Adapter\OpenID; use Hybridauth\HttpClient; /** * PayPal OpenID provider adapter. */ -class PaypalOpenID extends OpenIDAdapter +class PaypalOpenID extends OpenID { /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $openidIdentifier = 'https://www.sandbox.paypal.com/webapps/auth/server'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ + protected $apiDocumentation = 'https://developer.paypal.com/docs/connect-with-paypal/'; + + /** + * {@inheritdoc} + */ public function authenticateBegin() { - $this->openIdClient->identity = $this->openidIdentifier; + $this->openIdClient->identity = $this->openidIdentifier; $this->openIdClient->returnUrl = $this->callback; - $this->openIdClient->required = [ + $this->openIdClient->required = [ 'namePerson/prefix', 'namePerson/first', 'namePerson/last', diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/QQ.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/QQ.php index c0107c77b..88e1bbb6a 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/QQ.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/QQ.php @@ -12,7 +12,6 @@ use Hybridauth\User\Profile; */ class QQ extends OAuth2 { - /** * {@inheritdoc} */ @@ -54,6 +53,11 @@ class QQ extends OAuth2 */ protected $tokenRefreshMethod = 'GET'; + /** + * {@inheritdoc} + */ + protected $apiDocumentation = ''; // Not available + /** * {@inheritdoc} */ @@ -61,12 +65,12 @@ class QQ extends OAuth2 { parent::initialize(); - $this->tokenRefreshParameters = [ - 'grant_type' => 'refresh_token', - 'client_id' => $this->clientId, - 'client_secret' => $this->clientSecret, - 'refresh_token' => $this->getStoredData('refresh_token'), - ]; + if ($this->isRefreshTokenAvailable()) { + $this->tokenRefreshParameters += [ + 'client_id' => $this->clientId, + 'client_secret' => $this->clientSecret, + ]; + } $this->apiRequestParameters = [ 'access_token' => $this->getStoredData('access_token') diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Reddit.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Reddit.php index d66e614eb..fa48b0f44 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Reddit.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Reddit.php @@ -18,33 +18,33 @@ use Hybridauth\User; class Reddit extends OAuth2 { /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $scope = 'identity'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $apiBaseUrl = 'https://oauth.reddit.com/api/v1/'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $authorizeUrl = 'https://ssl.reddit.com/api/v1/authorize'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $accessTokenUrl = 'https://ssl.reddit.com/api/v1/access_token'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $apiDocumentation = 'https://github.com/reddit/reddit/wiki/OAuth2'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected function initialize() { parent::initialize(); @@ -54,36 +54,37 @@ class Reddit extends OAuth2 ]; $this->tokenExchangeParameters = [ - 'client_id' => $this->clientId, - 'grant_type' => 'authorization_code', + 'client_id' => $this->clientId, + 'grant_type' => 'authorization_code', 'redirect_uri' => $this->callback ]; $this->tokenExchangeHeaders = [ - 'Authorization' => 'Basic ' . base64_encode($this->clientId . ':' . $this->clientSecret) + 'Authorization' => 'Basic ' . base64_encode($this->clientId . ':' . $this->clientSecret) ]; $this->tokenRefreshHeaders = $this->tokenExchangeHeaders; } /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function getUserProfile() { $response = $this->apiRequest('me.json'); $data = new Data\Collection($response); - if (! $data->exists('id')) { + if (!$data->exists('id')) { throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); } $userProfile = new User\Profile(); - $userProfile->identifier = $data->get('id'); + $userProfile->identifier = $data->get('id'); $userProfile->displayName = $data->get('name'); - $userProfile->profileURL = 'https://www.reddit.com/user/' . $data->get('name') . '/'; + $userProfile->profileURL = 'https://www.reddit.com/user/' . $data->get('name') . '/'; + $userProfile->photoURL = $data->get('icon_img'); return $userProfile; } diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Slack.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Slack.php index 4d6c34e24..d424b8d72 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Slack.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Slack.php @@ -17,11 +17,10 @@ use Hybridauth\User; */ class Slack extends OAuth2 { - /** * {@inheritdoc} */ - public $scope = 'identity.basic identity.email identity.avatar'; + protected $scope = 'identity.basic identity.email identity.avatar'; /** * {@inheritdoc} diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Spotify.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Spotify.php index 8cf3db507..c995efe21 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Spotify.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Spotify.php @@ -17,11 +17,10 @@ use Hybridauth\User; */ class Spotify extends OAuth2 { - /** * {@inheritdoc} */ - public $scope = 'user-read-email'; + protected $scope = 'user-read-email'; /** * {@inheritdoc} @@ -38,6 +37,11 @@ class Spotify extends OAuth2 */ protected $accessTokenUrl = 'https://accounts.spotify.com/api/token'; + /** + * {@inheritdoc} + */ + protected $apiDocumentation = 'https://developer.spotify.com/documentation/general/guides/authorization-guide/'; + /** * {@inheritdoc} */ diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/StackExchange.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/StackExchange.php index f9cf5719f..240b9f6d6 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/StackExchange.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/StackExchange.php @@ -19,66 +19,74 @@ use Hybridauth\User; * * $config = [ * 'callback' => Hybridauth\HttpClient\Util::getCurrentUrl(), - * 'keys' => [ 'id' => '', 'secret' => '' ], - * 'site' => 'stackoverflow' - * 'api_key' => '...' // that thing to receive a higher request quota. + * 'keys' => ['id' => '', 'secret' => ''], + * 'site' => 'stackoverflow' // required parameter to call getUserProfile() + * 'api_key' => '...' // that thing to receive a higher request quota. * ]; * - * $adapter = new Hybridauth\Provider\StackExchange( $config ); + * $adapter = new Hybridauth\Provider\StackExchange($config); * - * $adapter->authenticate(); + * try { + * $adapter->authenticate(); * - * $userProfile = $adapter->getUserProfile(); + * $userProfile = $adapter->getUserProfile(); + * $tokens = $adapter->getAccessToken(); + * } catch (\Exception $e ){ + * echo $e->getMessage() ; + * } */ class StackExchange extends OAuth2 { /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $scope = null; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $apiBaseUrl = 'https://api.stackexchange.com/2.2/'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $authorizeUrl = 'https://stackexchange.com/oauth'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $accessTokenUrl = 'https://stackexchange.com/oauth/access_token'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $apiDocumentation = 'https://api.stackexchange.com/docs/authentication'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected function initialize() { parent::initialize(); $apiKey = $this->config->get('api_key'); - $this->apiRequestParameters = [ 'key' => $apiKey]; + $this->apiRequestParameters = ['key' => $apiKey]; } /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ public function getUserProfile() { $site = $this->config->get('site'); - $response = $this->apiRequest('me?site=' . $site); + $response = $this->apiRequest('me', 'GET', [ + 'site' => $site, + 'access_token' => $this->getStoredData('access_token'), + ]); - if (! $response || !isset($response->items) || !isset($response->items[0])) { + if (!$response || !isset($response->items) || !isset($response->items[0])) { throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); } @@ -86,12 +94,12 @@ class StackExchange extends OAuth2 $userProfile = new User\Profile(); - $userProfile->identifier = $data->get('id'); + $userProfile->identifier = strval($data->get('user_id')); $userProfile->displayName = $data->get('display_name'); - $userProfile->photoURL = $data->get('profile_image'); - $userProfile->profileURL = $data->get('link'); - $userProfile->region = $data->get('location'); - $userProfile->age = $data->get('age'); + $userProfile->photoURL = $data->get('profile_image'); + $userProfile->profileURL = $data->get('link'); + $userProfile->region = $data->get('location'); + $userProfile->age = $data->get('age'); return $userProfile; } diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/StackExchangeOpenID.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/StackExchangeOpenID.php index 9c40f7772..4e8d5763e 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/StackExchangeOpenID.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/StackExchangeOpenID.php @@ -7,28 +7,33 @@ namespace Hybridauth\Provider; -use Hybridauth\Adapter\OpenID as OpenIDAdapter; +use Hybridauth\Adapter\OpenID; /** * StackExchange OpenID provider adapter. */ -class StackExchangeOpenID extends OpenIDAdapter +class StackExchangeOpenID extends OpenID { /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $openidIdentifier = 'https://openid.stackexchange.com/'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ + protected $apiDocumentation = 'https://openid.stackexchange.com/'; + + /** + * {@inheritdoc} + */ public function authenticateFinish() { parent::authenticateFinish(); $userProfile = $this->storage->get($this->providerId . '.user'); - $userProfile->identifier = !empty($userProfile->identifier) ? $userProfile->identifier : $userProfile->email; + $userProfile->identifier = !empty($userProfile->identifier) ? $userProfile->identifier : $userProfile->email; $userProfile->emailVerified = $userProfile->email; // re store the user profile diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Steam.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Steam.php index 1fad3b5e1..1288f0a74 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Steam.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Steam.php @@ -7,7 +7,7 @@ namespace Hybridauth\Provider; -use Hybridauth\Adapter\OpenID as OpenIDAdapter; +use Hybridauth\Adapter\OpenID; use Hybridauth\Exception\UnexpectedApiResponseException; use Hybridauth\Data; use Hybridauth\User; @@ -19,25 +19,34 @@ use Hybridauth\User; * * $config = [ * 'callback' => Hybridauth\HttpClient\Util::getCurrentUrl(), - * 'keys' => [ 'secret' => 'steam-api-key' ] + * 'keys' => ['secret' => 'steam-api-key'] * ]; * - * $adapter = new Hybridauth\Provider\Steam( $config ); + * $adapter = new Hybridauth\Provider\Steam($config); * - * $adapter->authenticate(); - - * $userProfile = $adapter->getUserProfile(); + * try { + * $adapter->authenticate(); + * + * $userProfile = $adapter->getUserProfile(); + * } catch (\Exception $e) { + * echo $e->getMessage() ; + * } */ -class Steam extends OpenIDAdapter +class Steam extends OpenID { /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ protected $openidIdentifier = 'http://steamcommunity.com/openid'; /** - * {@inheritdoc} - */ + * {@inheritdoc} + */ + protected $apiDocumentation = 'https://steamcommunity.com/dev'; + + /** + * {@inheritdoc} + */ public function authenticateFinish() { parent::authenticateFinish(); @@ -85,7 +94,7 @@ class Steam extends OpenIDAdapter */ public function getUserProfileWebAPI($apiKey, $steam64) { - $q = http_build_query(['key' => $apiKey, 'steamid' => $steam64]); + $q = http_build_query(['key' => $apiKey, 'steamids' => $steam64]); $apiUrl = 'http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?' . $q; $response = $this->httpClient->request($apiUrl); @@ -111,7 +120,7 @@ class Steam extends OpenIDAdapter * Fetch user profile on community API * @param $steam64 * @return array -*/ + */ public function getUserProfileLegacyAPI($steam64) { libxml_use_internal_errors(false); @@ -132,8 +141,8 @@ class Steam extends OpenIDAdapter $userProfile['description'] = (string)$data->get('summary'); $userProfile['region'] = (string)$data->get('location'); $userProfile['profileURL'] = (string)$data->get('customURL') - ? 'http://steamcommunity.com/id/' . (string)$data->get('customURL') - : 'http://steamcommunity.com/profiles/' . $steam64; + ? 'http://steamcommunity.com/id/' . (string)$data->get('customURL') + : 'http://steamcommunity.com/profiles/' . $steam64; return $userProfile; } diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/SteemConnect.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/SteemConnect.php index f3b4727aa..2bc0e5d1e 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/SteemConnect.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/SteemConnect.php @@ -51,7 +51,7 @@ class SteemConnect extends OAuth2 $data = new Data\Collection($response); - if (! $data->exists('result')) { + if (!$data->exists('result')) { throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); } @@ -59,10 +59,10 @@ class SteemConnect extends OAuth2 $data = $data->filter('result'); - $userProfile->identifier = $data->get('id'); + $userProfile->identifier = $data->get('id'); $userProfile->description = $data->get('about'); - $userProfile->photoURL = $data->get('profile_image'); - $userProfile->webSiteURL = $data->get('website'); + $userProfile->photoURL = $data->get('profile_image'); + $userProfile->webSiteURL = $data->get('website'); $userProfile->displayName = $data->get('name'); return $userProfile; diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Strava.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Strava.php index 336a7bc9f..f98cc3ab6 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Strava.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Strava.php @@ -20,7 +20,7 @@ class Strava extends OAuth2 /** * {@inheritdoc} */ - public $scope = 'profile:read_all'; + protected $scope = 'profile:read_all'; /** * {@inheritdoc} @@ -51,13 +51,13 @@ class Strava extends OAuth2 $data = new Data\Collection($response); - if (! $data->exists('id')) { + if (!$data->exists('id')) { throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); } $userProfile = new User\Profile(); - $userProfile->identifier = $data->get('id'); + $userProfile->identifier = $data->get('id'); $userProfile->firstName = $data->get('firstname'); $userProfile->lastName = $data->get('lastname'); $userProfile->gender = $data->get('sex'); diff --git a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Telegram.php b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Telegram.php index cf2dc30a3..28d3d0908 100644 --- a/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Telegram.php +++ b/e107_handlers/vendor/hybridauth/hybridauth/src/Provider/Telegram.php @@ -14,11 +14,22 @@ use Hybridauth\Exception\UnexpectedApiResponseException; /** * Telegram provider adapter. * + * To set up Telegram you need to interactively create a bot using the + * Telegram mobile app, talking to botfather. The minimum conversation + * will look like: + * + * /newbot + * My Bot Title + * nameofmynewbot + * /setdomain + * @nameofmynewbot + * mydomain.com + * * Example: * * $config = [ - * 'callback' => Hybridauth\HttpClient\Util::getCurrentUrl(), - * 'keys' => ['id' => 'your_bot_name', 'secret' => 'your_bot_token'], + * 'callback' => Hybridauth\HttpClient\Util::getCurrentUrl(), + * 'keys' => ['id' => 'your_bot_name', 'secret' => 'your_bot_token'], * ]; * * $adapter = new Hybridauth\Provider\Telegram($config); @@ -27,20 +38,23 @@ use Hybridauth\Exception\UnexpectedApiResponseException; * $adapter->authenticate(); * * $userProfile = $adapter->getUserProfile(); - * } - * catch(\Exception $e) { + * } catch (\Exception $e) { * print $e->getMessage(); * } */ class Telegram extends AbstractAdapter implements AdapterInterface { - protected $botId = ''; protected $botSecret = ''; protected $callbackUrl = ''; + /** + * {@inheritdoc} + */ + protected $apiDocumentation = 'https://core.telegram.org/bots'; + /** * {@inheritdoc} */ @@ -79,12 +93,20 @@ class Telegram extends AbstractAdapter implements AdapterInterface return null; } + /** + * {@inheritdoc} + */ + public function isConnected() + { + return !empty($this->getStoredData('auth_data')); + } + /** * {@inheritdoc} */ public function getUserProfile() { - $data = new Collection($this->parseAuthData()); + $data = new Collection($this->getStoredData('auth_data')); if (!$data->exists('id')) { throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); @@ -92,11 +114,16 @@ class Telegram extends AbstractAdapter implements AdapterInterface $userProfile = new Profile(); - $userProfile->identifier = $data->get('id'); - $userProfile->firstName = $data->get('first_name'); - $userProfile->lastName = $data->get('last_name'); - $userProfile->displayName = $data->get('username'); - $userProfile->photoURL = $data->get('photo_url'); + $userProfile->identifier = $data->get('id'); + $userProfile->firstName = $data->get('first_name'); + $userProfile->lastName = $data->get('last_name'); + $userProfile->displayName = $data->get('username'); + $userProfile->photoURL = $data->get('photo_url'); + $username = $data->get('username'); + if (!empty($username)) { + // Only some accounts have usernames. + $userProfile->profileURL = "https://t.me/{$username}"; + } return $userProfile; } @@ -144,10 +171,14 @@ class Telegram extends AbstractAdapter implements AdapterInterface { $this->logger->debug(sprintf('%s::authenticateBegin(), redirecting user to:', get_class($this))); + $nonce = $this->config->get('nonce'); + $nonce_code = empty($nonce) ? '' : "nonce=\"{$nonce}\""; + exit( <<