Skip to content

Commit

Permalink
Fix bug caused by param check being too strict.
Browse files Browse the repository at this point in the history
  • Loading branch information
Potherca committed Jan 13, 2022
1 parent e19e283 commit 4281459
Showing 1 changed file with 3 additions and 22 deletions.
25 changes: 3 additions & 22 deletions src/Controller/AuthorizeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,13 @@ final public function __invoke(ServerRequestInterface $request, array $args): Re

$queryParams = $request->getQueryParams();

if (! isset($queryParams['request'])) {
return $this->getResponse()
->withStatus(400, "Bad request, missing request")
;
}

$parser = new \Lcobucci\JWT\Parser();

try {
$token = $parser->parse($queryParams['request']);
} catch (\Exception $exception) {
return $this->getResponse()
->withStatus(400, $exception->getMessage())
;
}

try {
$token = $parser->parse($request->getQueryParams()['request']);
$_SESSION["nonce"] = $token->getClaim('nonce');
} catch(\OutOfBoundsException $e) {
if (! isset($queryParams['nonce'])) {
return $this->getResponse()
->withStatus(400, "Bad request, missing nonce")
;
}

$_SESSION["nonce"] = $queryParams['nonce'];
} catch(\Exception $e) {
$_SESSION["nonce"] = $request->getQueryParams()['nonce'];
}

/*/ Prepare GET parameters for OAUTH server request /*/
Expand Down

0 comments on commit 4281459

Please sign in to comment.