Skip to content

Commit 4a8178b

Browse files
committed
Add interface for Jti Storage, to be extended by projects consuming this library.
1 parent 26c8b1b commit 4a8178b

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

src/JtiStorageInterface.php

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
3+
namespace Pdsinterop\Solid\Auth;
4+
5+
/**
6+
* This interface defines methods that a storage layer need to implement
7+
* in order to allow the JTI Service to validate JTI tokens.
8+
*
9+
* Such a token is a string between 12 and [..] characters of length.
10+
*/
11+
interface JtiStorageInterface
12+
{
13+
/**
14+
* Store a given JTI for a given URI
15+
*
16+
* @param string|object $jti string or string-able object
17+
* @param string $targetUri
18+
*
19+
* @return void
20+
*
21+
* @throws \Exception When storage fails, any type of Exception might be thrown...
22+
*/
23+
public function store(string|object $jti, string $targetUri): void;
24+
25+
/**
26+
* Retrieve a given JTI for a given URI
27+
*
28+
* @param string|object $jti string or string-able object
29+
* @param string $targetUri
30+
*
31+
* @return bool
32+
*
33+
* @throws \Exception When retrieval fails, any type of Exception might be thrown...
34+
*/
35+
public function retrieve(string|object $jti, string $targetUri): bool;
36+
37+
/**
38+
* Create a new storage slot and discard the oldest slot
39+
*
40+
* @return void
41+
*
42+
* @throws \Exception When rotation fails, any type of Exception might be thrown...
43+
*/
44+
public function rotateBuckets(): void;
45+
}

0 commit comments

Comments
 (0)