From 8ba0c3420d348a7b504e0b3ab836342e14fc3fa8 Mon Sep 17 00:00:00 2001 From: Brandon Johnson Date: Tue, 19 May 2015 00:48:11 -0400 Subject: [PATCH] Lots of updates --- composer.json | 10 +- composer.lock | 348 +++++++++--------- config/sgtaziz.steamauth.php | 17 + src/Facades/SteamAuth.php | 17 + .../OpenID.php => Libraries/LightOpenID.php} | 280 +++++++------- src/SteamAuth.php | 70 ++++ src/SteamAuthServiceProvider.php | 42 +++ src/config/steamauth.php | 6 - src/sgtaziz/SteamAuth/Facades/SteamAuth.php | 13 - src/sgtaziz/SteamAuth/SteamAuth.php | 54 --- .../SteamAuth/SteamAuthServiceProvider.php | 31 -- 11 files changed, 483 insertions(+), 405 deletions(-) create mode 100644 config/sgtaziz.steamauth.php create mode 100644 src/Facades/SteamAuth.php rename src/{sgtaziz/SteamAuth/Libraries/OpenID.php => Libraries/LightOpenID.php} (90%) create mode 100644 src/SteamAuth.php create mode 100644 src/SteamAuthServiceProvider.php delete mode 100644 src/config/steamauth.php delete mode 100644 src/sgtaziz/SteamAuth/Facades/SteamAuth.php delete mode 100644 src/sgtaziz/SteamAuth/SteamAuth.php delete mode 100644 src/sgtaziz/SteamAuth/SteamAuthServiceProvider.php diff --git a/composer.json b/composer.json index b1c625b..d7dc1e0 100644 --- a/composer.json +++ b/composer.json @@ -8,14 +8,20 @@ "email": "sgtaziz013@gmail.com" } ], - "minimum-stability": "dev", "require": { "php": ">=5.3.0", "laravel/framework": "5.0.*" }, "autoload": { "psr-4": { - "sgtaziz\\SteamAuth\\": "src/sgtaziz/SteamAuth" + "sgtaziz\\SteamAuth\\": "src/" } } + "extra": { + "component": "package", + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "minimum-stability": "dev" } diff --git a/composer.lock b/composer.lock index 84bcc5b..21a3832 100644 --- a/composer.lock +++ b/composer.lock @@ -1,10 +1,10 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "13cf7d21cda06fd5d59959ab5639ef01", + "hash": "cc7234c16719b20dc10fade8e4d83a47", "packages": [ { "name": "classpreloader/classpreloader", @@ -12,16 +12,16 @@ "source": { "type": "git", "url": "https://github.com/ClassPreloader/ClassPreloader.git", - "reference": "84664e1802d369aa10de1011b8abd73bce368c7f" + "reference": "1f92ba13688e7871498540108f0aaabc02c1afa3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ClassPreloader/ClassPreloader/zipball/84664e1802d369aa10de1011b8abd73bce368c7f", - "reference": "84664e1802d369aa10de1011b8abd73bce368c7f", + "url": "https://api.github.com/repos/ClassPreloader/ClassPreloader/zipball/1f92ba13688e7871498540108f0aaabc02c1afa3", + "reference": "1f92ba13688e7871498540108f0aaabc02c1afa3", "shasum": "" }, "require": { - "nikic/php-parser": "~1.0", + "nikic/php-parser": "~1.3", "php": ">=5.3.3", "symfony/console": "~2.1", "symfony/filesystem": "~2.1", @@ -36,7 +36,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2-dev" + "dev-master": "1.4-dev" } }, "autoload": { @@ -64,7 +64,7 @@ "class", "preload" ], - "time": "2015-01-27 07:22:18" + "time": "2015-05-17 22:35:15" }, { "name": "danielstjules/stringy", @@ -356,16 +356,16 @@ "source": { "type": "git", "url": "https://github.com/jeremeamia/super_closure.git", - "reference": "b712f39c671e5ead60c7ebfe662545456aade833" + "reference": "832e743b90e05af9a4fa2ff638036793a836425f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/jeremeamia/super_closure/zipball/b712f39c671e5ead60c7ebfe662545456aade833", - "reference": "b712f39c671e5ead60c7ebfe662545456aade833", + "url": "https://api.github.com/repos/jeremeamia/super_closure/zipball/832e743b90e05af9a4fa2ff638036793a836425f", + "reference": "832e743b90e05af9a4fa2ff638036793a836425f", "shasum": "" }, "require": { - "nikic/php-parser": "~1.0", + "nikic/php-parser": "~1.2", "php": ">=5.4" }, "require-dev": { @@ -375,7 +375,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1-dev" + "dev-master": "2.2-dev" } }, "autoload": { @@ -406,7 +406,7 @@ "serialize", "tokenizer" ], - "time": "2015-03-11 20:06:43" + "time": "2015-05-05 01:58:28" }, { "name": "laravel/framework", @@ -414,12 +414,12 @@ "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "7cbf8f7d596bc83ca4d34fa3b28e04a2a65688f0" + "reference": "b397448b6087650520653f668181e63afc1d947c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/7cbf8f7d596bc83ca4d34fa3b28e04a2a65688f0", - "reference": "7cbf8f7d596bc83ca4d34fa3b28e04a2a65688f0", + "url": "https://api.github.com/repos/laravel/framework/zipball/b397448b6087650520653f668181e63afc1d947c", + "reference": "b397448b6087650520653f668181e63afc1d947c", "shasum": "" }, "require": { @@ -489,7 +489,7 @@ "predis/predis": "~1.0" }, "suggest": { - "aws/aws-sdk-php": "Required to use the SQS queue driver (~2.4).", + "aws/aws-sdk-php": "Required to use the SQS queue driver and SES mail driver (~2.4).", "doctrine/dbal": "Required to rename columns and drop SQLite columns (~2.4).", "guzzlehttp/guzzle": "Required to use the Mailgun and Mandrill mail drivers (~5.0).", "iron-io/iron_mq": "Required to use the iron queue driver (~1.5).", @@ -532,7 +532,7 @@ "framework", "laravel" ], - "time": "2015-03-14 16:25:56" + "time": "2015-05-15 14:53:41" }, { "name": "league/flysystem", @@ -540,22 +540,23 @@ "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "51cd7cd7ee0defbaafc6ec0d3620110a5d71e11a" + "reference": "166a16f7e966d5eac46fb7a9849db21734718495" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/51cd7cd7ee0defbaafc6ec0d3620110a5d71e11a", - "reference": "51cd7cd7ee0defbaafc6ec0d3620110a5d71e11a", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/166a16f7e966d5eac46fb7a9849db21734718495", + "reference": "166a16f7e966d5eac46fb7a9849db21734718495", "shasum": "" }, "require": { + "ext-mbstring": "*", "php": ">=5.4.0" }, "require-dev": { "ext-fileinfo": "*", "league/phpunit-coverage-listener": "~1.1", "mockery/mockery": "~0.9", - "phpspec/phpspec": "~2.0.0", + "phpspec/phpspec": "~2.0", "phpspec/prophecy-phpunit": "~1.0", "phpunit/phpunit": "~4.1", "predis/predis": "~1.0", @@ -615,7 +616,7 @@ "sftp", "storage" ], - "time": "2015-03-10 11:04:14" + "time": "2015-05-13 16:20:53" }, { "name": "monolog/monolog", @@ -623,12 +624,12 @@ "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "c31a2c4e8db5da8b46c74cf275d7f109c0f249ac" + "reference": "bf2bff61743f20a13dc46ff1e3bbd0f19c997d2b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/c31a2c4e8db5da8b46c74cf275d7f109c0f249ac", - "reference": "c31a2c4e8db5da8b46c74cf275d7f109c0f249ac", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/bf2bff61743f20a13dc46ff1e3bbd0f19c997d2b", + "reference": "bf2bff61743f20a13dc46ff1e3bbd0f19c997d2b", "shasum": "" }, "require": { @@ -642,6 +643,7 @@ "aws/aws-sdk-php": "~2.4, >2.4.8", "doctrine/couchdb": "~1.0@dev", "graylog2/gelf-php": "~1.0", + "php-console/php-console": "~3.1, >3.1.2", "phpunit/phpunit": "~4.0", "raven/raven": "~0.5", "ruflin/elastica": "0.90.*", @@ -654,6 +656,7 @@ "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", "ext-mongo": "Allow sending log messages to a MongoDB server", "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", + "php-console/php-console": "Allow sending log messages to Google Chrome", "raven/raven": "Allow sending log messages to a Sentry server", "rollbar/rollbar": "Allow sending log messages to Rollbar", "ruflin/elastica": "Allow sending log messages to an Elastic Search server", @@ -688,7 +691,7 @@ "logging", "psr-3" ], - "time": "2015-03-09 09:58:04" + "time": "2015-05-11 14:51:05" }, { "name": "mtdowling/cron-expression", @@ -736,20 +739,21 @@ }, { "name": "nesbot/carbon", - "version": "1.17.0", + "version": "1.19.0", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "a1dd1ad9abfc8b3c4d8768068e6c71d293424e86" + "reference": "68868e0b02d2d803d0052a59d4e5003cccf87320" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/a1dd1ad9abfc8b3c4d8768068e6c71d293424e86", - "reference": "a1dd1ad9abfc8b3c4d8768068e6c71d293424e86", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/68868e0b02d2d803d0052a59d4e5003cccf87320", + "reference": "68868e0b02d2d803d0052a59d4e5003cccf87320", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=5.3.0", + "symfony/translation": "~2.6" }, "require-dev": { "phpunit/phpunit": "~4.0" @@ -778,20 +782,20 @@ "datetime", "time" ], - "time": "2015-03-08 14:05:44" + "time": "2015-05-09 03:23:44" }, { "name": "nikic/php-parser", - "version": "dev-master", + "version": "1.x-dev", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "592836c4dc9ca96e8843ed96fd1cac82a74c4df1" + "reference": "30abe062f22c770aff8e8f086413d1b6fadbd684" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/592836c4dc9ca96e8843ed96fd1cac82a74c4df1", - "reference": "592836c4dc9ca96e8843ed96fd1cac82a74c4df1", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/30abe062f22c770aff8e8f086413d1b6fadbd684", + "reference": "30abe062f22c770aff8e8f086413d1b6fadbd684", "shasum": "" }, "require": { @@ -801,7 +805,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "1.3-dev" } }, "autoload": { @@ -823,7 +827,7 @@ "parser", "php" ], - "time": "2015-03-14 18:53:08" + "time": "2015-05-02 20:03:33" }, { "name": "psr/log", @@ -831,12 +835,12 @@ "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "1af1529b49a6e065ae6802e70192aba35d79b7d8" + "reference": "bf2c13de4300e227d7b2fd08027673a79c519987" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/1af1529b49a6e065ae6802e70192aba35d79b7d8", - "reference": "1af1529b49a6e065ae6802e70192aba35d79b7d8", + "url": "https://api.github.com/repos/php-fig/log/zipball/bf2c13de4300e227d7b2fd08027673a79c519987", + "reference": "bf2c13de4300e227d7b2fd08027673a79c519987", "shasum": "" }, "type": "library", @@ -846,8 +850,8 @@ } }, "autoload": { - "psr-0": { - "Psr\\Log\\": "" + "psr-4": { + "Psr\\Log\\": "Psr/Log/" } }, "notification-url": "https://packagist.org/downloads/", @@ -866,20 +870,20 @@ "psr", "psr-3" ], - "time": "2015-02-05 09:32:11" + "time": "2015-03-26 14:39:45" }, { "name": "psy/psysh", - "version": "dev-develop", + "version": "v0.4.4", "source": { "type": "git", "url": "https://github.com/bobthecow/psysh.git", - "reference": "207fa817645c3d5a8a535829e2f2ffdf2e6fe155" + "reference": "489816db71649bd95b416e3ed9062d40528ab0ac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/207fa817645c3d5a8a535829e2f2ffdf2e6fe155", - "reference": "207fa817645c3d5a8a535829e2f2ffdf2e6fe155", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/489816db71649bd95b416e3ed9062d40528ab0ac", + "reference": "489816db71649bd95b416e3ed9062d40528ab0ac", "shasum": "" }, "require": { @@ -937,27 +941,27 @@ "interactive", "shell" ], - "time": "2015-03-14 17:35:55" + "time": "2015-03-26 18:43:54" }, { "name": "swiftmailer/swiftmailer", - "version": "dev-master", + "version": "5.x-dev", "source": { "type": "git", "url": "https://github.com/swiftmailer/swiftmailer.git", - "reference": "048be6f7c19944d604e321347990543bc2bbe10b" + "reference": "ac8b475454c120bfb31f5bef475233dd4fb6b626" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/048be6f7c19944d604e321347990543bc2bbe10b", - "reference": "048be6f7c19944d604e321347990543bc2bbe10b", + "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/ac8b475454c120bfb31f5bef475233dd4fb6b626", + "reference": "ac8b475454c120bfb31f5bef475233dd4fb6b626", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { - "mockery/mockery": "~0.9.1" + "mockery/mockery": "~0.9.1,<0.9.4" }, "type": "library", "extra": { @@ -989,7 +993,7 @@ "mail", "mailer" ], - "time": "2015-03-14 06:07:26" + "time": "2015-05-06 16:40:00" }, { "name": "symfony/console", @@ -998,12 +1002,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/Console.git", - "reference": "53f86497ccd01677e22435cfb7262599450a90d1" + "reference": "8e89c40a2664c78a19f37e11b18b1099c9f098f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Console/zipball/53f86497ccd01677e22435cfb7262599450a90d1", - "reference": "53f86497ccd01677e22435cfb7262599450a90d1", + "url": "https://api.github.com/repos/symfony/Console/zipball/8e89c40a2664c78a19f37e11b18b1099c9f098f2", + "reference": "8e89c40a2664c78a19f37e11b18b1099c9f098f2", "shasum": "" }, "require": { @@ -1036,18 +1040,18 @@ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, { "name": "Fabien Potencier", "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony Console Component", - "homepage": "http://symfony.com", - "time": "2015-03-13 17:37:22" + "homepage": "https://symfony.com", + "time": "2015-05-16 13:04:19" }, { "name": "symfony/debug", @@ -1056,12 +1060,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/Debug.git", - "reference": "a6dd8ca51d5136838bdcd91e12a1a132ff46590e" + "reference": "c214e92851ac0569269393078ab2ebae3e00797d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Debug/zipball/a6dd8ca51d5136838bdcd91e12a1a132ff46590e", - "reference": "a6dd8ca51d5136838bdcd91e12a1a132ff46590e", + "url": "https://api.github.com/repos/symfony/Debug/zipball/c214e92851ac0569269393078ab2ebae3e00797d", + "reference": "c214e92851ac0569269393078ab2ebae3e00797d", "shasum": "" }, "require": { @@ -1097,32 +1101,31 @@ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, { "name": "Fabien Potencier", "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony Debug Component", - "homepage": "http://symfony.com", - "time": "2015-03-12 14:30:42" + "homepage": "https://symfony.com", + "time": "2015-05-15 13:32:45" }, { "name": "symfony/event-dispatcher", - "version": "2.7.x-dev", - "target-dir": "Symfony/Component/EventDispatcher", + "version": "2.8.x-dev", "source": { "type": "git", "url": "https://github.com/symfony/EventDispatcher.git", - "reference": "186349c2966529804e38685f671e64746dde220b" + "reference": "8766cebf28beac9a45b511d7dba053da9d35eb9f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/186349c2966529804e38685f671e64746dde220b", - "reference": "186349c2966529804e38685f671e64746dde220b", + "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/8766cebf28beac9a45b511d7dba053da9d35eb9f", + "reference": "8766cebf28beac9a45b511d7dba053da9d35eb9f", "shasum": "" }, "require": { @@ -1143,11 +1146,11 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "2.8-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\EventDispatcher\\": "" } }, @@ -1156,32 +1159,31 @@ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, { "name": "Fabien Potencier", "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony EventDispatcher Component", - "homepage": "http://symfony.com", - "time": "2015-03-13 17:50:01" + "homepage": "https://symfony.com", + "time": "2015-05-12 15:16:46" }, { "name": "symfony/filesystem", - "version": "2.7.x-dev", - "target-dir": "Symfony/Component/Filesystem", + "version": "2.8.x-dev", "source": { "type": "git", "url": "https://github.com/symfony/Filesystem.git", - "reference": "cd84fd71bce5e9e136cab7e1fbc07af877e3a932" + "reference": "45cc231f1ecac70a8790bf1c88a823af8ce57056" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Filesystem/zipball/cd84fd71bce5e9e136cab7e1fbc07af877e3a932", - "reference": "cd84fd71bce5e9e136cab7e1fbc07af877e3a932", + "url": "https://api.github.com/repos/symfony/Filesystem/zipball/45cc231f1ecac70a8790bf1c88a823af8ce57056", + "reference": "45cc231f1ecac70a8790bf1c88a823af8ce57056", "shasum": "" }, "require": { @@ -1193,11 +1195,11 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "2.8-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Symfony\\Component\\Filesystem\\": "" } }, @@ -1206,18 +1208,18 @@ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, { "name": "Fabien Potencier", "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony Filesystem Component", - "homepage": "http://symfony.com", - "time": "2015-03-12 14:31:07" + "homepage": "https://symfony.com", + "time": "2015-05-15 14:11:12" }, { "name": "symfony/finder", @@ -1226,12 +1228,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/Finder.git", - "reference": "bebc7479c566fa4f14b9bcef9e32e719eabec74e" + "reference": "ffedd3e0ff8155188155e9322fe21b9ee012ac14" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Finder/zipball/bebc7479c566fa4f14b9bcef9e32e719eabec74e", - "reference": "bebc7479c566fa4f14b9bcef9e32e719eabec74e", + "url": "https://api.github.com/repos/symfony/Finder/zipball/ffedd3e0ff8155188155e9322fe21b9ee012ac14", + "reference": "ffedd3e0ff8155188155e9322fe21b9ee012ac14", "shasum": "" }, "require": { @@ -1256,18 +1258,18 @@ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, { "name": "Fabien Potencier", "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony Finder Component", - "homepage": "http://symfony.com", - "time": "2015-03-12 10:28:44" + "homepage": "https://symfony.com", + "time": "2015-05-15 13:32:45" }, { "name": "symfony/http-foundation", @@ -1276,12 +1278,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/HttpFoundation.git", - "reference": "d527885e37b55ec0e3dc6f4b70566d0f9b2f2388" + "reference": "92f809c6c1a050c017024ce77bcff95ae16f375d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/HttpFoundation/zipball/d527885e37b55ec0e3dc6f4b70566d0f9b2f2388", - "reference": "d527885e37b55ec0e3dc6f4b70566d0f9b2f2388", + "url": "https://api.github.com/repos/symfony/HttpFoundation/zipball/92f809c6c1a050c017024ce77bcff95ae16f375d", + "reference": "92f809c6c1a050c017024ce77bcff95ae16f375d", "shasum": "" }, "require": { @@ -1310,18 +1312,18 @@ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, { "name": "Fabien Potencier", "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony HttpFoundation Component", - "homepage": "http://symfony.com", - "time": "2015-03-13 17:37:22" + "homepage": "https://symfony.com", + "time": "2015-05-15 13:32:45" }, { "name": "symfony/http-kernel", @@ -1330,12 +1332,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/HttpKernel.git", - "reference": "faf449b3265a8801e6bd96331a9ba8ba93d65d9d" + "reference": "6c9c3e92f451047c9f9bf07dae109f3ce11f7e39" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/HttpKernel/zipball/faf449b3265a8801e6bd96331a9ba8ba93d65d9d", - "reference": "faf449b3265a8801e6bd96331a9ba8ba93d65d9d", + "url": "https://api.github.com/repos/symfony/HttpKernel/zipball/6c9c3e92f451047c9f9bf07dae109f3ce11f7e39", + "reference": "6c9c3e92f451047c9f9bf07dae109f3ce11f7e39", "shasum": "" }, "require": { @@ -1388,18 +1390,18 @@ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, { "name": "Fabien Potencier", "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony HttpKernel Component", - "homepage": "http://symfony.com", - "time": "2015-03-13 17:37:22" + "homepage": "https://symfony.com", + "time": "2015-05-15 13:32:45" }, { "name": "symfony/process", @@ -1408,12 +1410,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/Process.git", - "reference": "4d717f34f3d1d6ab30fbe79f7132960a27f4a0dc" + "reference": "7856d78ab6cce6e59d02d9e1a873441f6bd21306" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Process/zipball/4d717f34f3d1d6ab30fbe79f7132960a27f4a0dc", - "reference": "4d717f34f3d1d6ab30fbe79f7132960a27f4a0dc", + "url": "https://api.github.com/repos/symfony/Process/zipball/7856d78ab6cce6e59d02d9e1a873441f6bd21306", + "reference": "7856d78ab6cce6e59d02d9e1a873441f6bd21306", "shasum": "" }, "require": { @@ -1438,18 +1440,18 @@ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, { "name": "Fabien Potencier", "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony Process Component", - "homepage": "http://symfony.com", - "time": "2015-03-12 10:28:44" + "homepage": "https://symfony.com", + "time": "2015-05-15 13:32:45" }, { "name": "symfony/routing", @@ -1458,12 +1460,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/Routing.git", - "reference": "a7f3eb540e5c553c3c95993c6fc2e7edb2f3b9d2" + "reference": "dc9df18a1cfe87de65e270e8f01407ca6d7c39cb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Routing/zipball/a7f3eb540e5c553c3c95993c6fc2e7edb2f3b9d2", - "reference": "a7f3eb540e5c553c3c95993c6fc2e7edb2f3b9d2", + "url": "https://api.github.com/repos/symfony/Routing/zipball/dc9df18a1cfe87de65e270e8f01407ca6d7c39cb", + "reference": "dc9df18a1cfe87de65e270e8f01407ca6d7c39cb", "shasum": "" }, "require": { @@ -1501,24 +1503,24 @@ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, { "name": "Fabien Potencier", "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony Routing Component", - "homepage": "http://symfony.com", + "homepage": "https://symfony.com", "keywords": [ "router", "routing", "uri", "url" ], - "time": "2015-03-13 17:37:22" + "time": "2015-05-15 13:32:45" }, { "name": "symfony/security-core", @@ -1527,12 +1529,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/security-core.git", - "reference": "889290a5c00d3f174cc73ce13a11a0a6406939e9" + "reference": "1ad0ee4b2a1ab32924cd0be397f0196b5d47e5d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-core/zipball/889290a5c00d3f174cc73ce13a11a0a6406939e9", - "reference": "889290a5c00d3f174cc73ce13a11a0a6406939e9", + "url": "https://api.github.com/repos/symfony/security-core/zipball/1ad0ee4b2a1ab32924cd0be397f0196b5d47e5d0", + "reference": "1ad0ee4b2a1ab32924cd0be397f0196b5d47e5d0", "shasum": "" }, "require": { @@ -1571,18 +1573,18 @@ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, { "name": "Fabien Potencier", "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony Security Component - Core Library", - "homepage": "http://symfony.com", - "time": "2015-03-13 17:37:22" + "homepage": "https://symfony.com", + "time": "2015-05-15 13:53:19" }, { "name": "symfony/translation", @@ -1591,12 +1593,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/Translation.git", - "reference": "043db5f1eef9598d1bc1d75b93304984c003d7d9" + "reference": "cdd2168e61f57a434e35565a776ac143b0400154" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Translation/zipball/043db5f1eef9598d1bc1d75b93304984c003d7d9", - "reference": "043db5f1eef9598d1bc1d75b93304984c003d7d9", + "url": "https://api.github.com/repos/symfony/Translation/zipball/cdd2168e61f57a434e35565a776ac143b0400154", + "reference": "cdd2168e61f57a434e35565a776ac143b0400154", "shasum": "" }, "require": { @@ -1630,18 +1632,18 @@ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, { "name": "Fabien Potencier", "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony Translation Component", - "homepage": "http://symfony.com", - "time": "2015-03-14 11:42:25" + "homepage": "https://symfony.com", + "time": "2015-05-15 13:32:45" }, { "name": "symfony/var-dumper", @@ -1650,12 +1652,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "61ee6c848fd2c623e13f59df48833f8b8bad7fda" + "reference": "89eec96645fb44af4a454a26c74c72ba6311f5bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/61ee6c848fd2c623e13f59df48833f8b8bad7fda", - "reference": "61ee6c848fd2c623e13f59df48833f8b8bad7fda", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/89eec96645fb44af4a454a26c74c72ba6311f5bc", + "reference": "89eec96645fb44af4a454a26c74c72ba6311f5bc", "shasum": "" }, "require": { @@ -1686,22 +1688,22 @@ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, { "name": "Nicolas Grekas", "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony mechanism for exploring and dumping PHP variables", - "homepage": "http://symfony.com", + "homepage": "https://symfony.com", "keywords": [ "debug", "dump" ], - "time": "2015-03-06 16:45:31" + "time": "2015-05-01 14:14:24" }, { "name": "vlucas/phpdotenv", diff --git a/config/sgtaziz.steamauth.php b/config/sgtaziz.steamauth.php new file mode 100644 index 0000000..e03eaf4 --- /dev/null +++ b/config/sgtaziz.steamauth.php @@ -0,0 +1,17 @@ + '', + +]; diff --git a/src/Facades/SteamAuth.php b/src/Facades/SteamAuth.php new file mode 100644 index 0000000..8c22a43 --- /dev/null +++ b/src/Facades/SteamAuth.php @@ -0,0 +1,17 @@ += 5.1.2 with cURL or HTTP/HTTPS stream wrappers enabled. * * @version v1.2.0 (2014-01-14) @@ -11,6 +12,7 @@ * @copyright Copyright (c) 2013 Mewp * @license http://opensource.org/licenses/mit-license.php MIT License */ + class LightOpenID { public $returnUrl @@ -22,12 +24,15 @@ class LightOpenID , $cnmatch = null , $data , $oauth = array(); + private $identity, $claimed_id; + protected $server, $version, $trustRoot, $aliases, $identifier_select = false , $ax = false, $sreg = false, $setup_url = null, $headers = array() , $proxy = null, $user_agent = 'LightOpenID' , $xrds_override_pattern = null, $xrds_override_replacement = null; - static protected $ax_to_sreg = array( + + protected static $ax_to_sreg = array( 'namePerson/friendly' => 'nickname', 'contact/email' => 'email', 'namePerson' => 'fullname', @@ -39,7 +44,7 @@ class LightOpenID 'pref/timezone' => 'timezone', ); - function __construct($host, $proxy = null) + public function __construct($host, $proxy = null) { $this->set_realm($host); $this->set_proxy($proxy); @@ -49,17 +54,17 @@ function __construct($host, $proxy = null) $this->data = ($_SERVER['REQUEST_METHOD'] === 'POST') ? $_POST : $_GET; - if(!function_exists('curl_init') && !in_array('https', stream_get_wrappers())) { + if (!function_exists('curl_init') && !in_array('https', stream_get_wrappers())) { throw new ErrorException('You must have either https wrappers or curl enabled.'); } } - - function __isset($name) + + public function __isset($name) { return in_array($name, array('identity', 'trustRoot', 'realm', 'xrdsOverride', 'mode')); } - function __set($name, $value) + public function __set($name, $value) { switch ($name) { case 'identity': @@ -91,7 +96,7 @@ function __set($name, $value) } } - function __get($name) + public function __get($name) { switch ($name) { case 'identity': @@ -106,15 +111,15 @@ function __get($name) return empty($this->data['openid_mode']) ? null : $this->data['openid_mode']; } } - - function set_proxy($proxy) + + public function set_proxy($proxy) { if (!empty($proxy)) { // When the proxy is a string - try to parse it. if (!is_array($proxy)) { $proxy = parse_url($proxy); } - + // Check if $proxy is valid after the parsing. if ($proxy && !empty($proxy['host'])) { // Make sure that a valid port number is specified. @@ -122,12 +127,12 @@ function set_proxy($proxy) if (!is_int($proxy['port'])) { $proxy['port'] = is_numeric($proxy['port']) ? intval($proxy['port']) : 0; } - + if ($proxy['port'] <= 0) { throw new ErrorException('The specified proxy port number is invalid.'); } } - + $this->proxy = $proxy; } } @@ -139,7 +144,7 @@ function set_proxy($proxy) * @param $url url to check * @return true, if the server exists; false otherwise */ - function hostExists($url) + public function hostExists($url) { if (strpos($url, '/') === false) { $server = $url; @@ -153,33 +158,33 @@ function hostExists($url) return !!gethostbynamel($server); } - + protected function set_realm($uri) { $realm = ''; - + # Set a protocol, if not specified. $realm .= (($offset = strpos($uri, '://')) === false) ? $this->get_realm_protocol() : ''; - + # Set the offset properly. $offset = (($offset !== false) ? $offset + 3 : 0); - + # Get only the root, without the path. $realm .= (($end = strpos($uri, '/', $offset)) === false) ? $uri : substr($uri, 0, $end); - + $this->trustRoot = $realm; } - + protected function get_realm_protocol() { if (!empty($_SERVER['HTTPS'])) { $use_secure_protocol = ($_SERVER['HTTPS'] != 'off'); - } else if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) { + } elseif (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) { $use_secure_protocol = ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'); } else { $use_secure_protocol = false; } - + return $use_secure_protocol ? 'https://' : 'http://'; } @@ -192,32 +197,32 @@ protected function request_curl($url, $method='GET', $params=array(), $update_cl curl_setopt($curl, CURLOPT_USERAGENT, $this->user_agent); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); - + if ($method == 'POST') { curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-type: application/x-www-form-urlencoded')); } else { curl_setopt($curl, CURLOPT_HTTPHEADER, array('Accept: application/xrds+xml, */*')); } - + if (!empty($this->proxy)) { curl_setopt($curl, CURLOPT_PROXY, $this->proxy['host']); - + if (!empty($this->proxy['port'])) { curl_setopt($curl, CURLOPT_PROXYPORT, $this->proxy['port']); } - + if (!empty($this->proxy['user'])) { - curl_setopt($curl, CURLOPT_PROXYUSERPWD, $this->proxy['user'] . ':' . $this->proxy['pass']); + curl_setopt($curl, CURLOPT_PROXYUSERPWD, $this->proxy['user'] . ':' . $this->proxy['pass']); } } - if($this->verify_peer !== null) { + if ($this->verify_peer !== null) { curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, $this->verify_peer); - if($this->capath) { + if ($this->capath) { curl_setopt($curl, CURLOPT_CAPATH, $this->capath); } - if($this->cainfo) { + if ($this->cainfo) { curl_setopt($curl, CURLOPT_CAINFO, $this->cainfo); } } @@ -234,30 +239,30 @@ protected function request_curl($url, $method='GET', $params=array(), $update_cl } $response = curl_exec($curl); - if($method == 'HEAD' && curl_getinfo($curl, CURLINFO_HTTP_CODE) == 405) { + if ($method == 'HEAD' && curl_getinfo($curl, CURLINFO_HTTP_CODE) == 405) { curl_setopt($curl, CURLOPT_HTTPGET, true); $response = curl_exec($curl); $response = substr($response, 0, strpos($response, "\r\n\r\n")); } - if($method == 'HEAD' || $method == 'GET') { + if ($method == 'HEAD' || $method == 'GET') { $header_response = $response; # If it's a GET request, we want to only parse the header part. - if($method == 'GET') { + if ($method == 'GET') { $header_response = substr($response, 0, strpos($response, "\r\n\r\n")); } $headers = array(); - foreach(explode("\n", $header_response) as $header) { - $pos = strpos($header,':'); + foreach (explode("\n", $header_response) as $header) { + $pos = strpos($header, ':'); if ($pos !== false) { $name = strtolower(trim(substr($header, 0, $pos))); $headers[$name] = trim(substr($header, $pos+1)); } } - if($update_claimed_id) { + if ($update_claimed_id) { # Update the claimed_id value in case of redirections. $effective_url = curl_getinfo($curl, CURLINFO_EFFECTIVE_URL); # Ignore the fragment (some cURL versions don't handle it well). @@ -266,7 +271,7 @@ protected function request_curl($url, $method='GET', $params=array(), $update_cl } } - if($method == 'HEAD') { + if ($method == 'HEAD') { return $headers; } else { $this->headers = $headers; @@ -283,8 +288,8 @@ protected function request_curl($url, $method='GET', $params=array(), $update_cl protected function parse_header_array($array, $update_claimed_id) { $headers = array(); - foreach($array as $header) { - $pos = strpos($header,':'); + foreach ($array as $header) { + $pos = strpos($header, ':'); if ($pos !== false) { $name = strtolower(trim(substr($header, 0, $pos))); $headers[$name] = trim(substr($header, $pos+1)); @@ -294,10 +299,10 @@ protected function parse_header_array($array, $update_claimed_id) # are followed automatically. # We ignore redirections with relative paths. # If any known provider uses them, file a bug report. - if($name == 'location' && $update_claimed_id) { - if(strpos($headers[$name], 'http') === 0) { + if ($name == 'location' && $update_claimed_id) { + if (strpos($headers[$name], 'http') === 0) { $this->identity = $this->claimed_id = $headers[$name]; - } elseif($headers[$name][0] == '/') { + } elseif ($headers[$name][0] == '/') { $parsed_url = parse_url($this->claimed_id); $this->identity = $this->claimed_id = $parsed_url['scheme'] . '://' @@ -312,16 +317,16 @@ protected function parse_header_array($array, $update_claimed_id) protected function request_streams($url, $method='GET', $params=array(), $update_claimed_id) { - if(!$this->hostExists($url)) { + if (!$this->hostExists($url)) { throw new ErrorException("Could not connect to $url.", 404); } - + if (empty($this->cnmatch)) { $this->cnmatch = parse_url($url, PHP_URL_HOST); } $params = http_build_query($params, '', '&'); - switch($method) { + switch ($method) { case 'GET': $opts = array( 'http' => array( @@ -357,10 +362,10 @@ protected function request_streams($url, $method='GET', $params=array(), $update } break; case 'HEAD': - // We want to send a HEAD request, but since get_headers() doesn't + // We want to send a HEAD request, but since get_headers() doesn't // accept $context parameter, we have to change the defaults. $default = stream_context_get_options(stream_context_get_default()); - + // PHP does not reset all options. Instead, it just sets the options // available in the passed array, therefore set the defaults manually. $default += array( @@ -376,7 +381,7 @@ protected function request_streams($url, $method='GET', $params=array(), $update $default['ssl'] += array( 'CN_match' => '' ); - + $opts = array( 'http' => array( 'method' => 'HEAD', @@ -388,7 +393,7 @@ protected function request_streams($url, $method='GET', $params=array(), $update 'CN_match' => $this->cnmatch ) ); - + // Enable validation of the SSL certificates. if ($this->verify_peer) { $default['ssl'] += array( @@ -402,15 +407,15 @@ protected function request_streams($url, $method='GET', $params=array(), $update 'cafile' => $this->cainfo ); } - + // Change the stream context options. stream_context_get_default($opts); - + $headers = get_headers($url . ($params ? '?' . $params : '')); - + // Restore the stream context options. stream_context_get_default($default); - + if (!empty($headers)) { if (intval(substr($headers[0], strlen('HTTP/1.1 '))) == 405) { // The server doesn't support HEAD - emulate it with a GET. @@ -424,7 +429,7 @@ protected function request_streams($url, $method='GET', $params=array(), $update } else { $headers = array(); } - + return $headers; } @@ -436,11 +441,11 @@ protected function request_streams($url, $method='GET', $params=array(), $update ); } - $context = stream_context_create ($opts); + $context = stream_context_create($opts); $data = file_get_contents($url, false, $context); # This is a hack for providers who don't support HEAD requests. # It just creates the headers array for the last request in $this->headers. - if(isset($http_response_header)) { + if (isset($http_response_header)) { $this->headers = $this->parse_header_array($http_response_header, $update_claimed_id); } @@ -450,48 +455,48 @@ protected function request_streams($url, $method='GET', $params=array(), $update protected function request($url, $method='GET', $params=array(), $update_claimed_id=false) { $use_curl = false; - + if (function_exists('curl_init')) { if (!$use_curl) { # When allow_url_fopen is disabled, PHP streams will not work. $use_curl = !ini_get('allow_url_fopen'); } - + if (!$use_curl) { # When there is no HTTPS wrapper, PHP streams cannott be used. $use_curl = !in_array('https', stream_get_wrappers()); } - + if (!$use_curl) { # With open_basedir or safe_mode set, cURL can't follow redirects. $use_curl = !(ini_get('safe_mode') || ini_get('open_basedir')); } } - + return $use_curl ? $this->request_curl($url, $method, $params, $update_claimed_id) : $this->request_streams($url, $method, $params, $update_claimed_id); } - + protected function proxy_url() { $result = ''; - + if (!empty($this->proxy)) { $result = $this->proxy['host']; - + if (!empty($this->proxy['port'])) { $result = $result . ':' . $this->proxy['port']; } - + if (!empty($this->proxy['user'])) { $result = $this->proxy['user'] . ':' . $this->proxy['pass'] . '@' . $result; } - + $result = 'http://' . $result; } - + return $result; } @@ -533,9 +538,11 @@ protected function htmlTag($content, $tag, $attrName, $attrValue, $valueName) * @return String OP Endpoint (i.e. OpenID provider address). * @throws ErrorException */ - function discover($url) + public function discover($url) { - if (!$url) throw new ErrorException('No identity supplied.'); + if (!$url) { + throw new ErrorException('No identity supplied.'); + } # Use xri.net proxy to resolve i-name identities if (!preg_match('#^https?:#', $url)) { $url = "https://xri.net/$url"; @@ -548,7 +555,7 @@ function discover($url) # A flag to disable yadis discovery in case of failure in headers. $yadis = true; - + # Allows optional regex replacement of the URL, e.g. to use Google Apps # as an OpenID provider without setting up XRDS on the domain hosting. if (!is_null($this->xrds_override_pattern) && !is_null($this->xrds_override_replacement)) { @@ -571,13 +578,15 @@ function discover($url) $content = $this->request($url, 'GET'); preg_match_all('#(.*?)#s', $content, $m); - foreach($m[1] as $content) { + foreach ($m[1] as $content) { $content = ' ' . $content; # The space is added, so that strpos doesn't return 0. # OpenID 2 $ns = preg_quote('http://specs.openid.net/auth/2.0/', '#'); - if(preg_match('#\s*'.$ns.'(server|signon)\s*#s', $content, $type)) { - if ($type[1] == 'server') $this->identifier_select = true; + if (preg_match('#\s*'.$ns.'(server|signon)\s*#s', $content, $type)) { + if ($type[1] == 'server') { + $this->identifier_select = true; + } preg_match('#(.*)#', $content, $server); preg_match('#<(Local|Canonical)ID>(.*)#', $content, $delegate); @@ -590,7 +599,9 @@ function discover($url) || strpos($content, 'http://openid.net/extensions/sreg/1.1'); $server = $server[1]; - if (isset($delegate[2])) $this->identity = trim($delegate[2]); + if (isset($delegate[2])) { + $this->identity = trim($delegate[2]); + } $this->version = 2; $this->server = $server; @@ -600,7 +611,6 @@ function discover($url) # OpenID 1.1 $ns = preg_quote('http://openid.net/signon/1.1', '#'); if (preg_match('#\s*'.$ns.'\s*#s', $content)) { - preg_match('#(.*)#', $content, $server); preg_match('#<.*?Delegate>(.*)#', $content, $delegate); if (empty($server)) { @@ -611,7 +621,9 @@ function discover($url) || strpos($content, 'http://openid.net/extensions/sreg/1.1'); $server = $server[1]; - if (isset($delegate[1])) $this->identity = $delegate[1]; + if (isset($delegate[1])) { + $this->identity = $delegate[1]; + } $this->version = 1; $this->server = $server; @@ -625,7 +637,9 @@ function discover($url) $content = null; break; } - if ($next) continue; + if ($next) { + continue; + } # There are no relevant information in headers, so we search the body. $content = $this->request($url, 'GET', array(), true); @@ -642,7 +656,9 @@ function discover($url) } } - if (!$content) $content = $this->request($url, 'GET'); + if (!$content) { + $content = $this->request($url, 'GET'); + } # At this point, the YADIS Discovery has failed, so we'll switch # to openid2 HTML discovery, then fallback to openid 1.1 discovery. @@ -671,19 +687,20 @@ function discover($url) } throw new ErrorException('Endless redirection!', 500); } - - protected function is_allowed_type($content_type) { + + protected function is_allowed_type($content_type) + { # Apparently, some providers return XRDS documents as text/html. # While it is against the spec, allowing this here shouldn't break # compatibility with anything. $allowed_types = array('application/xrds+xml', 'text/html', 'text/xml'); - + foreach ($allowed_types as $type) { if (strpos($content_type, $type) !== false) { return true; } } - + return false; } @@ -697,7 +714,9 @@ protected function sregParams() if ($this->required) { $params['openid.sreg.required'] = array(); foreach ($this->required as $required) { - if (!isset(self::$ax_to_sreg[$required])) continue; + if (!isset(self::$ax_to_sreg[$required])) { + continue; + } $params['openid.sreg.required'][] = self::$ax_to_sreg[$required]; } $params['openid.sreg.required'] = implode(',', $params['openid.sreg.required']); @@ -706,7 +725,9 @@ protected function sregParams() if ($this->optional) { $params['openid.sreg.optional'] = array(); foreach ($this->optional as $optional) { - if (!isset(self::$ax_to_sreg[$optional])) continue; + if (!isset(self::$ax_to_sreg[$optional])) { + continue; + } $params['openid.sreg.optional'][] = self::$ax_to_sreg[$optional]; } $params['openid.sreg.optional'] = implode(',', $params['openid.sreg.optional']); @@ -726,9 +747,13 @@ protected function axParams() $optional = array(); foreach (array('required','optional') as $type) { foreach ($this->$type as $alias => $field) { - if (is_int($alias)) $alias = strtr($field, '/', '_'); + if (is_int($alias)) { + $alias = strtr($field, '/', '_'); + } $this->aliases[$alias] = 'http://axschema.org/' . $field; - if (empty($counts[$alias])) $counts[$alias] = 0; + if (empty($counts[$alias])) { + $counts[$alias] = 0; + } $counts[$alias] += 1; ${$type}[] = $alias; } @@ -737,16 +762,18 @@ protected function axParams() $params['openid.ax.type.' . $alias] = $ns; } foreach ($counts as $alias => $count) { - if ($count == 1) continue; + if ($count == 1) { + continue; + } $params['openid.ax.count.' . $alias] = $count; } # Don't send empty ax.requied and ax.if_available. # Google and possibly other providers refuse to support ax when one of these is empty. - if($required) { + if ($required) { $params['openid.ax.required'] = implode(',', $required); } - if($optional) { + if ($optional) { $params['openid.ax.if_available'] = implode(',', $optional); } } @@ -759,7 +786,7 @@ protected function authUrl_v1($immediate) # If we have an openid.delegate that is different from our claimed id, # we need to somehow preserve the claimed id between requests. # The simplest way is to just send it along with the return_to url. - if($this->identity != $this->claimed_id) { + if ($this->identity != $this->claimed_id) { $returnUrl .= (strpos($returnUrl, '?') ? '&' : '?') . 'openid.claimed_id=' . $this->claimed_id; } @@ -770,8 +797,7 @@ protected function authUrl_v1($immediate) 'openid.trust_root' => $this->trustRoot, ) + $this->sregParams(); - return $this->build_url(parse_url($this->server) - , array('query' => http_build_query($params, '', '&'))); + return $this->build_url(parse_url($this->server), array('query' => http_build_query($params, '', '&'))); } protected function authUrl_v2($immediate) @@ -782,15 +808,15 @@ protected function authUrl_v2($immediate) 'openid.return_to' => $this->returnUrl, 'openid.realm' => $this->trustRoot, ); - + if ($this->ax) { $params += $this->axParams(); } - + if ($this->sreg) { $params += $this->sregParams(); } - + if (!$this->ax && !$this->sreg) { # If OP doesn't advertise either SREG, nor AX, let's send them both # in worst case we don't get anything in return. @@ -811,8 +837,7 @@ protected function authUrl_v2($immediate) $params['openid.claimed_id'] = $this->claimed_id; } - return $this->build_url(parse_url($this->server) - , array('query' => http_build_query($params, '', '&'))); + return $this->build_url(parse_url($this->server), array('query' => http_build_query($params, '', '&'))); } /** @@ -821,10 +846,14 @@ protected function authUrl_v2($immediate) * @param String $select_identifier Whether to request OP to select identity for an user in OpenID 2. Does not affect OpenID 1. * @throws ErrorException */ - function authUrl($immediate = false) + public function authUrl($immediate = false) { - if ($this->setup_url && !$immediate) return $this->setup_url; - if (!$this->server) $this->discover($this->identity); + if ($this->setup_url && !$immediate) { + return $this->setup_url; + } + if (!$this->server) { + $this->discover($this->identity); + } if ($this->version == 2) { return $this->authUrl_v2($immediate); @@ -837,17 +866,17 @@ function authUrl($immediate = false) * @return Bool Whether the verification was successful. * @throws ErrorException */ - function validate() + public function validate() { # If the request was using immediate mode, a failure may be reported # by presenting user_setup_url (for 1.1) or reporting # mode 'setup_needed' (for 2.0). Also catching all modes other than # id_res, in order to avoid throwing errors. - if(isset($this->data['openid_user_setup_url'])) { + if (isset($this->data['openid_user_setup_url'])) { $this->setup_url = $this->data['openid_user_setup_url']; return false; } - if($this->mode != 'id_res') { + if ($this->mode != 'id_res') { return false; } @@ -887,9 +916,8 @@ function validate() # In such case, validation would fail, since we'd send different data than OP # wants to verify. stripslashes() should solve that problem, but we can't # use it when magic_quotes is off. - $value = $this->data['openid_' . str_replace('.','_',$item)]; + $value = $this->data['openid_' . str_replace('.', '_', $item)]; $params['openid.' . $item] = function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc() ? stripslashes($value) : $value; - } $params['openid.mode'] = 'check_authentication'; @@ -902,36 +930,36 @@ function validate() protected function getAxAttributes() { $result = array(); - + if ($alias = $this->getNamespaceAlias('http://openid.net/srv/ax/1.0', 'ax')) { $prefix = 'openid_' . $alias; $length = strlen('http://axschema.org/'); - + foreach (explode(',', $this->data['openid_signed']) as $key) { $keyMatch = $alias . '.type.'; - + if (strncmp($key, $keyMatch, strlen($keyMatch)) !== 0) { continue; } - + $key = substr($key, strlen($keyMatch)); $idv = $prefix . '_value_' . $key; $idc = $prefix . '_count_' . $key; $key = substr($this->getItem($prefix . '_type_' . $key), $length); - + if (!empty($key)) { if (($count = intval($this->getItem($idc))) > 0) { $value = array(); - + for ($i = 1; $i <= $count; $i++) { $value[] = $this->getItem($idv . '_' . $i); } - + $value = ($count == 1) ? reset($value) : $value; } else { $value = $this->getItem($idv); } - + if (!is_null($value)) { $result[$key] = $value; } @@ -941,7 +969,7 @@ protected function getAxAttributes() // No alias for the AX schema has been found, // so there is no AX data in the OP's response. } - + return $result; } @@ -973,7 +1001,7 @@ protected function getSregAttributes() * * @return Array Array of attributes with keys being the AX schema names, e.g. 'contact/email' * @see http://www.axschema.org/types/ */ - function getAttributes() + public function getAttributes() { if (isset($this->data['openid_ns']) && $this->data['openid_ns'] == 'http://specs.openid.net/auth/2.0' @@ -990,19 +1018,19 @@ function getAttributes() * In order to use the OpenID+OAuth hybrid protocol, you need to add at least one * scope to the $openid->oauth array before you get the call to getAuthUrl(), e.g.: * $openid->oauth[] = 'https://www.googleapis.com/auth/plus.me'; - * - * Furthermore the registered consumer name must fit the OpenID realm. + * + * Furthermore the registered consumer name must fit the OpenID realm. * To register an OpenID consumer at Google use: https://www.google.com/accounts/ManageDomains - * + * * @return string|bool OAuth request token on success, FALSE if no token was provided. */ - function getOAuthRequestToken() + public function getOAuthRequestToken() { $alias = $this->getNamespaceAlias('http://specs.openid.net/extensions/oauth/1.0'); - + return !empty($alias) ? $this->data['openid_' . $alias . '_request_token'] : false; } - + /** * Gets the alias for the specified namespace, if it's present. * @@ -1013,13 +1041,13 @@ function getOAuthRequestToken() private function getNamespaceAlias($namespace, $hint = null) { $result = null; - + if (empty($hint) || $this->getItem('openid_ns_' . $hint) != $namespace) { // The common alias is either undefined or points to // some other extension - search for another alias.. $prefix = 'openid_ns_'; $length = strlen($prefix); - + foreach ($this->data as $key => $val) { if (strncmp($key, $prefix, $length) === 0 && $val === $namespace) { $result = trim(substr($key, $length)); @@ -1029,10 +1057,10 @@ private function getNamespaceAlias($namespace, $hint = null) } else { $result = $hint; } - + return $result; } - + /** * Gets an item from the $data array by the specified id. * @@ -1041,6 +1069,6 @@ private function getNamespaceAlias($namespace, $hint = null) */ private function getItem($id) { - return isset($this->data[$id]) ? $this->data[$id] : null; + return isset($this->data[$id]) ? $this->data[$id] : null; } } diff --git a/src/SteamAuth.php b/src/SteamAuth.php new file mode 100644 index 0000000..7c77028 --- /dev/null +++ b/src/SteamAuth.php @@ -0,0 +1,70 @@ +OpenID = new LightOpenID(url('')); + } + + /** + * Check for Steam Authorization + */ + public function Auth() + { + if (!$this->OpenID->mode) { + $this->OpenID->identity = $this->OpenIDURL; + $this->OpenID->returnUrl = url('') . $_SERVER['REQUEST_URI']; + + $this->RedirectTo($this->OpenID->authUrl()); + } elseif ($this->OpenID->mode == 'cancel') { + return false; + } elseif ($this->OpenID->validate()) { + $steamid64 = str_replace('http://steamcommunity.com/openid/id/', '', $this->OpenID->identity); + + if ($steamid64) { + $json = file_get_contents('http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=' . Config::get('sgtaziz.steamauth.SteamAPIKey') . '&steamids=' . $steamid64); + $json = json_decode($json, true); + + $user = $json["response"]["players"][0]; + + return $user; + } + } + + return false; + } + + /** + * Redirect to the given URL + * + * @param string $url + */ + public static function RedirectTo($url) + { + header("Location: $url"); + + die(); + } +} diff --git a/src/SteamAuthServiceProvider.php b/src/SteamAuthServiceProvider.php new file mode 100644 index 0000000..81290fb --- /dev/null +++ b/src/SteamAuthServiceProvider.php @@ -0,0 +1,42 @@ +mergeConfigFrom($configPath, 'sgtaziz.steamauth'); + $this->publishes([$configPath => config_path('sgtaziz.steamauth.php')], 'config'); + + $this->app->bindShared('sgtaziz.steamauth', function ($app) { + return new SteamAuth; + }); + + $this->app->alias('sgtaziz.steamauth', 'sgtaziz\SteamAuth\SteamAuth'); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return ['sgtaziz.steamauth']; + } +} diff --git a/src/config/steamauth.php b/src/config/steamauth.php deleted file mode 100644 index 09f8425..0000000 --- a/src/config/steamauth.php +++ /dev/null @@ -1,6 +0,0 @@ - '' //Enter your steam API key here. Can be found at https://steamcommunity.com/dev/apikey -]; diff --git a/src/sgtaziz/SteamAuth/Facades/SteamAuth.php b/src/sgtaziz/SteamAuth/Facades/SteamAuth.php deleted file mode 100644 index 278b207..0000000 --- a/src/sgtaziz/SteamAuth/Facades/SteamAuth.php +++ /dev/null @@ -1,13 +0,0 @@ -OpenID = new LightOpenID(url('')); - } - - public function Auth() - { - if (!$this->OpenID->mode) - { - $this->OpenID->identity = $this->OpenIDURL; - $this->OpenID->returnUrl = url('').$_SERVER['REQUEST_URI']; - - $this->RedirectTo($this->OpenID->authUrl()); - } - elseif ($this->OpenID->mode == 'cancel') - { - return false; - } - elseif ($this->OpenID->validate()) - { - $steamid64 = str_replace('http://steamcommunity.com/openid/id/', '', $this->OpenID->identity); - - if ($steamid64) - { - $json = file_get_contents('http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=' . Config::get('steamauth.SteamAPIKey') . '&steamids=' . $steamid64); - $json = json_decode($json, true); - - $user = $json["response"]["players"][0]; - - return $user; - } - } - - return false; - } - - public static function RedirectTo($url) - { - header( "Location: $url" ) ; - die(); - } -} diff --git a/src/sgtaziz/SteamAuth/SteamAuthServiceProvider.php b/src/sgtaziz/SteamAuth/SteamAuthServiceProvider.php deleted file mode 100644 index 3b40fb0..0000000 --- a/src/sgtaziz/SteamAuth/SteamAuthServiceProvider.php +++ /dev/null @@ -1,31 +0,0 @@ -app['steamauth'] = $this->app->share( - function ($app) { - return new SteamAuth; - } - ); - } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return array('steamauth'); - } -}