Skip to content

Commit 3674b86

Browse files
committed
add ReplayDetector that allows a callback
1 parent 385c46a commit 3674b86

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/Utils/ReplayDetector.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
namespace Pdsinterop\Solid\Auth\Utils;
4+
5+
use DateInterval;
6+
use Pdsinterop\Solid\Auth\ReplayDetectorInterface;
7+
8+
/**
9+
* Validates whether a provided JTI (JWT ID) is valid.
10+
*
11+
* @see https://datatracker.ietf.org/doc/html/draft-ietf-oauth-dpop
12+
*/
13+
class ReplayDetector implements ReplayDetectorInterface
14+
{
15+
private $callback;
16+
17+
public function __construct($callback) {
18+
$this->callback = $callback;
19+
}
20+
public function detect(string $jti, string $targetUri): bool
21+
{
22+
return ($this->callback)($jti, $targetUri);
23+
}
24+
}

0 commit comments

Comments
 (0)