Skip to content

Commit b2a8475

Browse files
committed
middleware requires a route name or specified JWT ID
1 parent 922245a commit b2a8475

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/JwtValidateMiddleware.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ class JwtValidateMiddleware
1010
{
1111
public function handle(Request $request, Closure $next, $id = null)
1212
{
13-
if ($id === null) {
14-
$id = $request->route()->getName();
15-
}
13+
$id = $id ?? $request->route()->getName()
14+
?? throw new \RuntimeException("You must specify a route name or expected JWT ID to protect this route");
1615

1716
$token = ParsedToken::fromString(
1817
$this->findJWT($request)

0 commit comments

Comments
 (0)