Skip to content

Commit 920aed3

Browse files
authored
Merge pull request #1 from KroderDev/codex/encontrar-y-corregir-un-fallo
Fix JWT cache key path in ValidateJwt middleware
2 parents e35fc0e + 3a3ac53 commit 920aed3

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)