Skip to content

Commit

Permalink
middleware requires a route name or specified JWT ID
Browse files Browse the repository at this point in the history
  • Loading branch information
jszobody committed Feb 13, 2023
1 parent 922245a commit b2a8475
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/JwtValidateMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ class JwtValidateMiddleware
{
public function handle(Request $request, Closure $next, $id = null)
{
if ($id === null) {
$id = $request->route()->getName();
}
$id = $id ?? $request->route()->getName()
?? throw new \RuntimeException("You must specify a route name or expected JWT ID to protect this route");

$token = ParsedToken::fromString(
$this->findJWT($request)
Expand Down

0 comments on commit b2a8475

Please sign in to comment.