Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
bohanyang committed Oct 4, 2023
1 parent eea638e commit 6c60933
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/mango/Jose/CachedJWKSLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
use Symfony\Contracts\Cache\CacheInterface;
use Symfony\Contracts\Cache\ItemInterface;

use function hash;

class CachedJWKSLoader implements JWKSLoader
{
public function __construct(
Expand All @@ -25,7 +27,9 @@ public function __construct(

public function __invoke(): JWKSet
{
return $this->cache->get($this->url, function (ItemInterface $item) {
$hash = 'jwks:' . hash('xxh128', $this->url);

return $this->cache->get($hash, function (ItemInterface $item) {
$item->expiresAfter($this->expiresAfter);

return $this->jkuFactory->loadFromUrl($this->url, $this->header);
Expand Down

0 comments on commit 6c60933

Please sign in to comment.