From e407a3b780b9171086d0b0864849c372202109fa Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Tue, 25 Jul 2023 19:00:56 +0200 Subject: [PATCH] OAuth: Fix error when user id is numeric --- src/Controllers/OAuthController.php | 6 +++--- tests/Unit/Controllers/OAuthControllerTest.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Controllers/OAuthController.php b/src/Controllers/OAuthController.php index a0fc00e9..ff1da1cf 100644 --- a/src/Controllers/OAuthController.php +++ b/src/Controllers/OAuthController.php @@ -54,7 +54,7 @@ class OAuthController extends BaseController if (!$request->has('code')) { $authorizationUrl = $provider->getAuthorizationUrl( [ - // Leauge separates scopes by comma, which is wrong, so we do it + // League oauth separates scopes by comma, which is wrong, so we do it // here properly by spaces. See https://www.rfc-editor.org/rfc/rfc6749#section-3.3 'scope' => join(' ', $config['scope'] ?? []), ] @@ -101,7 +101,7 @@ class OAuthController extends BaseController ->where('provider', $providerName) ->where('identifier', $resourceId) ->get() - // Explicit case sensitive comparison using PHP as some DBMS collations are case sensitive and some arent + // Explicit case-sensitive comparison using PHP as some DBMS collations are case-sensitive and some aren't ->where('identifier', '===', (string) $resourceId) ->first(); @@ -150,7 +150,7 @@ class OAuthController extends BaseController if (!$oauth) { return $this->redirectRegister( $providerName, - $resourceId, + (string) $resourceId, $accessToken, $config, $userdata diff --git a/tests/Unit/Controllers/OAuthControllerTest.php b/tests/Unit/Controllers/OAuthControllerTest.php index 4c058421..99f2a1dd 100644 --- a/tests/Unit/Controllers/OAuthControllerTest.php +++ b/tests/Unit/Controllers/OAuthControllerTest.php @@ -408,7 +408,7 @@ class OAuthControllerTest extends TestCase $resourceOwner, 'getId', null, - 'ProVIdeR-User-IdenTifIer', // Case sensitive variation of existing entry + 'ProVIdeR-User-IdenTifIer', // case-sensitive variation of existing entry $this->atLeastOnce() ); $this->setExpects( @@ -508,7 +508,7 @@ class OAuthControllerTest extends TestCase null, [ 'nested' => [ - 'id' => 'new-provider-user-identifier', + 'id' => 42, // new provider user identifier 'name' => 'testuser', 'email' => 'foo.bar@localhost', 'first' => 'Test', @@ -621,7 +621,7 @@ class OAuthControllerTest extends TestCase } /** - * Setup the DB + * Set up the DB */ public function setUp(): void {