From e2933bd2dff3b29fdf61e9000aa72fc5e9b31356 Mon Sep 17 00:00:00 2001 From: Alexis Saettler Date: Tue, 6 Mar 2018 20:05:33 +0100 Subject: [PATCH] Use google2fa-laravel dev-master (#949) --- app/Http/Controllers/SettingsController.php | 4 +- composer.json | 10 +-- composer.lock | 86 ++++++++++----------- tests/Unit/Google2FATest.php | 19 ++--- 4 files changed, 53 insertions(+), 66 deletions(-) diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php index ac3a12b7a..1856deb6a 100644 --- a/app/Http/Controllers/SettingsController.php +++ b/app/Http/Controllers/SettingsController.php @@ -17,7 +17,7 @@ use App\Http\Requests\ImportsRequest; use App\Http\Requests\SettingsRequest; use Illuminate\Support\Facades\Storage; use App\Http\Requests\InvitationRequest; -use PragmaRX\Google2FALaravel\Support\Authenticator; +use PragmaRX\Google2FALaravel\Google2FA; class SettingsController extends Controller { @@ -437,6 +437,6 @@ class SettingsController extends Controller public function security(Request $request) { - return view('settings.security.index', ['is2FAActivated' => (new Authenticator($request))->isActivated()]); + return view('settings.security.index', ['is2FAActivated' => app('pragmarx.google2fa')->isActivated()]); } } diff --git a/composer.json b/composer.json index 4d2696c8b..b6e59d7cd 100644 --- a/composer.json +++ b/composer.json @@ -4,12 +4,6 @@ "license": "AGPL", "keywords": ["prm", "crm", "social"], "type": "project", - "repositories": [ - { - "type": "vcs", - "url": "https://github.com/asbiin/google2fa-laravel" - } - ], "require": { "php": ">=7.0.0", "ext-intl": "*", @@ -27,10 +21,10 @@ "laravel/passport": "^4.0", "laravel/socialite": "^3.0", "league/flysystem-aws-s3-v3": "~1.0", - "martinlindhe/laravel-vue-i18n-generator": "^0.1.21", + "martinlindhe/laravel-vue-i18n-generator": "^0.1.23", "paragonie/constant_time_encoding": "^2.2", "pragmarx/google2fa": "^2.0", - "pragmarx/google2fa-laravel": "dev-create-authenticator-controller", + "pragmarx/google2fa-laravel": "dev-master", "pragmarx/recovery": "^0.1.0", "predis/predis": "^1.1", "roave/security-advisories": "dev-master", diff --git a/composer.lock b/composer.lock index f7a6795b2..06be03a28 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "33ddd52e78c8621a5c3587ff3dd64f2f", + "content-hash": "5ff22b6e774d07b8d33d5544c0210e87", "packages": [ { "name": "aws/aws-sdk-php", @@ -2086,16 +2086,16 @@ }, { "name": "martinlindhe/laravel-vue-i18n-generator", - "version": "0.1.23", + "version": "0.1.28", "source": { "type": "git", "url": "https://github.com/martinlindhe/laravel-vue-i18n-generator.git", - "reference": "4b192ff02e618455e048655106db70ed6c77aa80" + "reference": "0dcfb5a080137ea0eb8349b8f8f495c2779fa761" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/martinlindhe/laravel-vue-i18n-generator/zipball/4b192ff02e618455e048655106db70ed6c77aa80", - "reference": "4b192ff02e618455e048655106db70ed6c77aa80", + "url": "https://api.github.com/repos/martinlindhe/laravel-vue-i18n-generator/zipball/0dcfb5a080137ea0eb8349b8f8f495c2779fa761", + "reference": "0dcfb5a080137ea0eb8349b8f8f495c2779fa761", "shasum": "" }, "require": { @@ -2135,7 +2135,7 @@ "laravel", "vue-i18n" ], - "time": "2018-02-10T22:37:25+00:00" + "time": "2018-03-06T08:38:31+00:00" }, { "name": "monolog/monolog", @@ -2709,16 +2709,16 @@ }, { "name": "pragmarx/google2fa-laravel", - "version": "dev-create-authenticator-controller", + "version": "dev-master", "source": { "type": "git", - "url": "https://github.com/asbiin/google2fa-laravel.git", - "reference": "8ac00145615458ca3d019def267ae57d96932948" + "url": "https://github.com/antonioribeiro/google2fa-laravel.git", + "reference": "7f0e4f3a8a3136a471fec10e826de6992ddd2ef5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/asbiin/google2fa-laravel/zipball/8ac00145615458ca3d019def267ae57d96932948", - "reference": "8ac00145615458ca3d019def267ae57d96932948", + "url": "https://api.github.com/repos/antonioribeiro/google2fa-laravel/zipball/7f0e4f3a8a3136a471fec10e826de6992ddd2ef5", + "reference": "7f0e4f3a8a3136a471fec10e826de6992ddd2ef5", "shasum": "" }, "require": { @@ -2741,7 +2741,7 @@ "Laravel" ], "branch-alias": { - "dev-master": "0.1-dev" + "dev-master": "0.2-dev" }, "laravel": { "providers": [ @@ -2758,6 +2758,7 @@ "spec\\PragmaRX\\Google2FALaravel\\": "tests/spec/" } }, + "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" ], @@ -2770,15 +2771,12 @@ ], "description": "A One Time Password Authentication package, compatible with Google Authenticator.", "keywords": [ - "authentication", + "Authentication", + "Two Factor Authentication", "google2fa", - "laravel", - "two factor authentication" + "laravel" ], - "support": { - "source": "https://github.com/asbiin/google2fa-laravel/tree/create-authenticator-controller" - }, - "time": "2017-12-27T12:15:03+00:00" + "time": "2018-02-27T21:31:16+00:00" }, { "name": "pragmarx/random", @@ -3105,16 +3103,16 @@ }, { "name": "psr/simple-cache", - "version": "1.0.0", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/php-fig/simple-cache.git", - "reference": "753fa598e8f3b9966c886fe13f370baa45ef0e24" + "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/753fa598e8f3b9966c886fe13f370baa45ef0e24", - "reference": "753fa598e8f3b9966c886fe13f370baa45ef0e24", + "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", + "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", "shasum": "" }, "require": { @@ -3149,7 +3147,7 @@ "psr-16", "simple-cache" ], - "time": "2017-01-02T13:31:39+00:00" + "time": "2017-10-23T01:57:42+00:00" }, { "name": "ramsey/uuid", @@ -3237,12 +3235,12 @@ "source": { "type": "git", "url": "https://github.com/Roave/SecurityAdvisories.git", - "reference": "5eb59cd740f7f76a7ad680089b6db941c645b7ba" + "reference": "efecacb8182814c1476c7b38c1053ef78823e127" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/5eb59cd740f7f76a7ad680089b6db941c645b7ba", - "reference": "5eb59cd740f7f76a7ad680089b6db941c645b7ba", + "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/efecacb8182814c1476c7b38c1053ef78823e127", + "reference": "efecacb8182814c1476c7b38c1053ef78823e127", "shasum": "" }, "conflict": { @@ -3273,7 +3271,7 @@ "doctrine/orm": ">=2,<2.4.8|>=2.5,<2.5.1", "dompdf/dompdf": ">=0.6,<0.6.2", "drupal/core": ">=8,<8.4.5", - "drupal/drupal": ">=8,<8.3.7", + "drupal/drupal": ">=8,<8.4.5", "erusev/parsedown": "<1.7", "ezsystems/ezpublish-legacy": ">=5.3,<5.3.12.3|>=5.4,<5.4.11.3|>=2017.8,<2017.8.1.1|>=2017.12,<2017.12.2.1", "firebase/php-jwt": "<2", @@ -3296,7 +3294,7 @@ "oro/crm": ">=1.7,<1.7.4", "oro/platform": ">=1.7,<1.7.4", "padraic/humbug_get_contents": "<1.1.2", - "pagarme/pagarme-php": ">=0,<9.9.99", + "pagarme/pagarme-php": ">=0,<3", "paragonie/random_compat": "<2", "phpmailer/phpmailer": ">=5,<5.2.24", "phpunit/phpunit": ">=4.8.19,<4.8.28|>=5.0.10,<5.6.3", @@ -3310,7 +3308,7 @@ "silverstripe/forum": "<=0.6.1|>=0.7,<=0.7.3", "silverstripe/framework": ">=3,<3.3", "silverstripe/userforms": "<3", - "simplesamlphp/saml2": "<1.10.4|>=2,<2.3.5|>=3,<3.1.1", + "simplesamlphp/saml2": "<1.10.6|>=2,<2.3.8|>=3,<3.1.4", "simplesamlphp/simplesamlphp": "<1.15.2", "simplesamlphp/simplesamlphp-module-infocard": "<1.0.1", "socalnick/scn-social-auth": "<1.15.2", @@ -3335,7 +3333,7 @@ "symfony/web-profiler-bundle": ">=2,<2.3.19|>=2.4,<2.4.9|>=2.5,<2.5.4", "symfony/yaml": ">=2,<2.0.22|>=2.1,<2.1.7", "thelia/backoffice-default-template": ">=2.1,<2.1.2", - "thelia/thelia": ">=2.1,<2.1.2|>=2.1.0-beta1,<2.1.3", + "thelia/thelia": ">=2.1.0-beta1,<2.1.3|>=2.1,<2.1.2", "titon/framework": ">=0,<9.9.99", "twig/twig": "<1.20", "typo3/cms": ">=6.2,<6.2.30|>=7,<7.6.22|>=8,<8.7.5", @@ -3385,7 +3383,7 @@ } ], "description": "Prevents installation of composer packages with known security vulnerabilities: no API, simply require it", - "time": "2018-03-02T15:31:47+00:00" + "time": "2018-03-06T15:15:10+00:00" }, { "name": "sabberworm/php-css-parser", @@ -3872,7 +3870,7 @@ }, { "name": "symfony/console", - "version": "v3.4.5", + "version": "v3.4.6", "source": { "type": "git", "url": "https://github.com/symfony/console.git", @@ -3994,7 +3992,7 @@ }, { "name": "symfony/debug", - "version": "v3.4.5", + "version": "v3.4.6", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", @@ -4050,7 +4048,7 @@ }, { "name": "symfony/event-dispatcher", - "version": "v4.0.5", + "version": "v4.0.6", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", @@ -4162,7 +4160,7 @@ }, { "name": "symfony/http-foundation", - "version": "v3.4.5", + "version": "v3.4.6", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", @@ -4216,16 +4214,16 @@ }, { "name": "symfony/http-kernel", - "version": "v3.4.5", + "version": "v3.4.6", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "494f950becf513c174f52f9010cedb9026c12a92" + "reference": "a443bbbd93682aa08e623fade4c94edd586ed2de" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/494f950becf513c174f52f9010cedb9026c12a92", - "reference": "494f950becf513c174f52f9010cedb9026c12a92", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/a443bbbd93682aa08e623fade4c94edd586ed2de", + "reference": "a443bbbd93682aa08e623fade4c94edd586ed2de", "shasum": "" }, "require": { @@ -4300,7 +4298,7 @@ ], "description": "Symfony HttpKernel Component", "homepage": "https://symfony.com", - "time": "2018-03-01T19:23:56+00:00" + "time": "2018-03-05T19:41:07+00:00" }, { "name": "symfony/polyfill-mbstring", @@ -4530,7 +4528,7 @@ }, { "name": "symfony/process", - "version": "v3.4.5", + "version": "v3.4.6", "source": { "type": "git", "url": "https://github.com/symfony/process.git", @@ -4639,7 +4637,7 @@ }, { "name": "symfony/routing", - "version": "v3.4.5", + "version": "v3.4.6", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", @@ -4717,7 +4715,7 @@ }, { "name": "symfony/translation", - "version": "v3.4.5", + "version": "v3.4.6", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", diff --git a/tests/Unit/Google2FATest.php b/tests/Unit/Google2FATest.php index 96096e17f..eafc556d7 100644 --- a/tests/Unit/Google2FATest.php +++ b/tests/Unit/Google2FATest.php @@ -7,7 +7,6 @@ use Tests\TestCase; use Illuminate\Session\Store; use App\Http\Requests\Request; use Illuminate\Session\NullSessionHandler; -use PragmaRX\Google2FALaravel\Support\Authenticator; class Google2FATest extends TestCase { @@ -22,9 +21,7 @@ class Google2FATest extends TestCase $secret = $google2fa->generateSecretKey(32); - $authenticator = new Authenticator(request()); - - $result = $authenticator->verifyGoogle2FA($secret, 'aaaaaa'); + $result = $google2fa->verifyGoogle2FA($secret, 'aaaaaa'); $this->assertEquals(false, $result); } @@ -41,9 +38,7 @@ class Google2FATest extends TestCase $secret = $google2fa->generateSecretKey(32); $one_time_password = $google2fa->getCurrentOtp($secret); - $authenticator = new Authenticator(request()); - - $result = $authenticator->verifyGoogle2FA($secret, $one_time_password); + $result = $google2fa->verifyGoogle2FA($secret, $one_time_password); $this->assertEquals(true, $result); } @@ -69,14 +64,14 @@ class Google2FATest extends TestCase $request->setLaravelSession(new Store('test', new NullSessionHandler)); $request->getSession()->start(); - $authenticator = new Authenticator($request); + $authenticator = new \PragmaRX\Google2FALaravel\Support\Authenticator($request); - $this->assertEquals(false, $authenticator->canPassWithoutCheckingOTP()); + $this->assertEquals(false, $authenticator->isAuthenticated()); - $this->assertEquals(true, $authenticator->isActivated()); + $this->assertEquals(true, $google2fa->isActivated()); - $authenticator->login(); + $google2fa->login(); - $this->assertEquals(true, $authenticator->canPassWithoutCheckingOTP()); + $this->assertEquals(true, $authenticator->isAuthenticated()); } }