-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Passport Compatibility for V9 #1402
Changes from 1 commit
db79663
bd459d7
39d3cd3
6dbbc9f
8264a40
e4dfdd6
d9d061d
fc15889
689b2c7
74f8abc
d1dc453
efd742b
df39bf6
7596935
16bd02c
02a85f2
669debf
c64d95e
26b33a6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -200,15 +200,15 @@ protected function getClientEntityOrFail(string $clientId, ServerRequestInterfac | |
* Gets the client credentials from the request from the request body or | ||
* the Http Basic Authorization header | ||
* | ||
* @return string[] | ||
* @return mixed[] | ||
*/ | ||
protected function getClientCredentials(ServerRequestInterface $request): array | ||
{ | ||
[$basicAuthUser, $basicAuthPassword] = $this->getBasicAuthCredentials($request); | ||
|
||
$clientId = $this->getRequestParameter('client_id', $request, $basicAuthUser); | ||
|
||
if (is_null($clientId) || !is_string($clientId)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we were on the right track here, checking if |
||
if (is_null($clientId)) { | ||
throw OAuthServerException::invalidRequest('client_id'); | ||
} | ||
|
||
|
@@ -218,7 +218,6 @@ protected function getClientCredentials(ServerRequestInterface $request): array | |
throw OAuthServerException::invalidRequest('client_secret'); | ||
} | ||
|
||
/* @phpstan-ignore-next-line */ | ||
return [$clientId, $clientSecret]; | ||
} | ||
|
||
|
@@ -287,10 +286,8 @@ private function convertScopesQueryStringToArray(string $scopes): array | |
|
||
/** | ||
* Retrieve request parameter. | ||
* | ||
* @return string[]|string|null | ||
*/ | ||
protected function getRequestParameter(string $parameter, ServerRequestInterface $request, string $default = null): array|string|null | ||
protected function getRequestParameter(string $parameter, ServerRequestInterface $request, mixed $default = null): mixed | ||
{ | ||
$requestParameters = (array) $request->getParsedBody(); | ||
|
||
|
@@ -333,23 +330,23 @@ protected function getBasicAuthCredentials(ServerRequestInterface $request): arr | |
/** | ||
* Retrieve query string parameter. | ||
*/ | ||
protected function getQueryStringParameter(string $parameter, ServerRequestInterface $request, ?string $default = null): ?string | ||
protected function getQueryStringParameter(string $parameter, ServerRequestInterface $request, mixed $default = null): ?string | ||
{ | ||
return isset($request->getQueryParams()[$parameter]) ? $request->getQueryParams()[$parameter] : $default; | ||
} | ||
|
||
/** | ||
* Retrieve cookie parameter. | ||
*/ | ||
protected function getCookieParameter(string $parameter, ServerRequestInterface $request, ?string $default = null): ?string | ||
protected function getCookieParameter(string $parameter, ServerRequestInterface $request, mixed $default = null): ?string | ||
{ | ||
return isset($request->getCookieParams()[$parameter]) ? $request->getCookieParams()[$parameter] : $default; | ||
} | ||
|
||
/** | ||
* Retrieve server parameter. | ||
*/ | ||
protected function getServerParameter(string $parameter, ServerRequestInterface $request, ?string $default = null): ?string | ||
protected function getServerParameter(string $parameter, ServerRequestInterface $request, mixed $default = null): ?string | ||
{ | ||
return isset($request->getServerParams()[$parameter]) ? $request->getServerParams()[$parameter] : $default; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,7 +80,7 @@ public function respondToDeviceAuthorizationRequest(ServerRequestInterface $requ | |
$this->getServerParameter('PHP_AUTH_USER', $request) | ||
); | ||
|
||
if ($clientId === null || !is_string($clientId)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as above. |
||
if ($clientId === null) { | ||
throw OAuthServerException::invalidRequest('client_id'); | ||
} | ||
|
||
|
@@ -180,7 +180,7 @@ protected function validateDeviceCode(ServerRequestInterface $request, ClientEnt | |
{ | ||
$deviceCode = $this->getRequestParameter('device_code', $request); | ||
|
||
if (is_null($deviceCode) || !is_string($deviceCode)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same. |
||
if (is_null($deviceCode)) { | ||
throw OAuthServerException::invalidRequest('device_code'); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.