Skip to content

Commit 3a3ac53

Browse files
committed
Fix JWT validation cache key and prefix handling
1 parent e35fc0e commit 3a3ac53

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Http/Middleware/ValidateJwt.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ public function handle(Request $request, Closure $next): Response
2929
return response()->json(['error' => 'Unauthorized'], Response::HTTP_UNAUTHORIZED);
3030
}
3131

32-
$token = substr($authHeader, 7);
32+
$token = substr($authHeader, strlen((string)$prefix) + 1);
3333

3434
try {
35-
$publicKey = Cache::remember('jwt_cache_ttl', config('microservice.auth.public_key_ttl', 3600), function() {
36-
return file_get_contents(config('microservice.auth.jwt_cache_ttl'));
35+
$publicKey = Cache::remember('jwt_public_key', config('microservice.auth.jwt_cache_ttl', 3600), function() {
36+
return file_get_contents(config('microservice.auth.jwt_public_key'));
3737
});
3838

3939
$decoded = JWT::decode($token, new Key($publicKey, config('microservice.auth.jwt_algorithm')));

0 commit comments

Comments
 (0)