OAuth: Fix error when user id is numeric
This commit is contained in:
parent
24f958b00d
commit
e407a3b780
|
@ -54,7 +54,7 @@ class OAuthController extends BaseController
|
||||||
if (!$request->has('code')) {
|
if (!$request->has('code')) {
|
||||||
$authorizationUrl = $provider->getAuthorizationUrl(
|
$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
|
// here properly by spaces. See https://www.rfc-editor.org/rfc/rfc6749#section-3.3
|
||||||
'scope' => join(' ', $config['scope'] ?? []),
|
'scope' => join(' ', $config['scope'] ?? []),
|
||||||
]
|
]
|
||||||
|
@ -101,7 +101,7 @@ class OAuthController extends BaseController
|
||||||
->where('provider', $providerName)
|
->where('provider', $providerName)
|
||||||
->where('identifier', $resourceId)
|
->where('identifier', $resourceId)
|
||||||
->get()
|
->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)
|
->where('identifier', '===', (string) $resourceId)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ class OAuthController extends BaseController
|
||||||
if (!$oauth) {
|
if (!$oauth) {
|
||||||
return $this->redirectRegister(
|
return $this->redirectRegister(
|
||||||
$providerName,
|
$providerName,
|
||||||
$resourceId,
|
(string) $resourceId,
|
||||||
$accessToken,
|
$accessToken,
|
||||||
$config,
|
$config,
|
||||||
$userdata
|
$userdata
|
||||||
|
|
|
@ -408,7 +408,7 @@ class OAuthControllerTest extends TestCase
|
||||||
$resourceOwner,
|
$resourceOwner,
|
||||||
'getId',
|
'getId',
|
||||||
null,
|
null,
|
||||||
'ProVIdeR-User-IdenTifIer', // Case sensitive variation of existing entry
|
'ProVIdeR-User-IdenTifIer', // case-sensitive variation of existing entry
|
||||||
$this->atLeastOnce()
|
$this->atLeastOnce()
|
||||||
);
|
);
|
||||||
$this->setExpects(
|
$this->setExpects(
|
||||||
|
@ -508,7 +508,7 @@ class OAuthControllerTest extends TestCase
|
||||||
null,
|
null,
|
||||||
[
|
[
|
||||||
'nested' => [
|
'nested' => [
|
||||||
'id' => 'new-provider-user-identifier',
|
'id' => 42, // new provider user identifier
|
||||||
'name' => 'testuser',
|
'name' => 'testuser',
|
||||||
'email' => 'foo.bar@localhost',
|
'email' => 'foo.bar@localhost',
|
||||||
'first' => 'Test',
|
'first' => 'Test',
|
||||||
|
@ -621,7 +621,7 @@ class OAuthControllerTest extends TestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setup the DB
|
* Set up the DB
|
||||||
*/
|
*/
|
||||||
public function setUp(): void
|
public function setUp(): void
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue