Skip to content

Commit

Permalink
adjust throwing exception
Browse files Browse the repository at this point in the history
  • Loading branch information
vd1992 committed Dec 19, 2023
1 parent 63177de commit 4797015
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions api/app/Http/Controllers/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use App\Services\OpenIdBearerTokenService;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Str;
use InvalidArgumentException;
use Lcobucci\JWT\Configuration;
Expand Down Expand Up @@ -80,15 +81,14 @@ public function authCallback(Request $request)
// pull token out of the response as json -> lcobucci parser, no key verification is being done here however
$idToken = $response->json('id_token');

$config = $this->fastSigner;
if (! ($idToken && is_string($idToken))) {
Log::debug((string) $response->body());
throw new InvalidArgumentException('id token is a '.gettype($idToken));
}

$config = $this->fastSigner;
assert($config instanceof Configuration);

throw_unless(
$idToken && is_string($idToken),
new InvalidArgumentException('id token is a '.gettype($idToken))
);

$token = $config->parser()->parse($idToken);
assert($token instanceof UnencryptedToken);

Expand Down

0 comments on commit 4797015

Please sign in to comment.