mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-12-22 21:19:46 +05:30
secure access to body params
This commit is contained in:
parent
95919a688e
commit
d2760e4ec7
@ -249,13 +249,15 @@ abstract class AbstractGrant implements GrantTypeInterface
|
||||
*/
|
||||
protected function getRequestParameter($parameter, ServerRequestInterface $request, $default = null)
|
||||
{
|
||||
return (isset($request->getParsedBody()[$parameter])) ? $request->getParsedBody()[$parameter] : $default;
|
||||
return (is_array($request->getParsedBody()) && isset($request->getParsedBody()[$parameter]))
|
||||
? $request->getParsedBody()[$parameter]
|
||||
: $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve server parameter.
|
||||
*
|
||||
* @param string|array $parameter
|
||||
* @param string $parameter
|
||||
* @param \Psr\Http\Message\ServerRequestInterface $request
|
||||
* @param mixed $default
|
||||
*
|
||||
@ -314,7 +316,8 @@ abstract class AbstractGrant implements GrantTypeInterface
|
||||
public function canRespondToRequest(ServerRequestInterface $request)
|
||||
{
|
||||
return (
|
||||
isset($request->getParsedBody()['grant_type'])
|
||||
is_array($request->getParsedBody())
|
||||
&& isset($request->getParsedBody()['grant_type'])
|
||||
&& $request->getParsedBody()['grant_type'] === $this->identifier
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user