blob: c83aa72ea2ac275f84d30946049d8fecf0a1f38a [file] [log] [blame]
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001<?php
2
3namespace OAuth2\Storage;
4
5/**
6 * Implement this interface to specify where the OAuth2 Server
7 * should get the JWT key for clients
8 *
9 * @TODO consider extending ClientInterface, as this will almost always
10 * be the same storage as retrieving clientData
11 *
12 * @author F21
13 * @author Brent Shaffer <bshafs at gmail dot com>
14 */
15interface JwtBearerInterface
16{
17 /**
18 * Get the public key associated with a client_id
19 *
20 * @param $client_id
21 * Client identifier to be checked with.
22 *
23 * @return
24 * STRING Return the public key for the client_id if it exists, and MUST return FALSE if it doesn't.
25 */
26 public function getClientKey($client_id, $subject);
27
28 /**
29 * Get a jti (JSON token identifier) by matching against the client_id, subject, audience and expiration.
30 *
31 * @param $client_id
32 * Client identifier to match.
33 *
34 * @param $subject
35 * The subject to match.
36 *
37 * @param $audience
38 * The audience to match.
39 *
40 * @param $expiration
41 * The expiration of the jti.
42 *
43 * @param $jti
44 * The jti to match.
45 *
46 * @return
47 * An associative array as below, and return NULL if the jti does not exist.
48 * - issuer: Stored client identifier.
49 * - subject: Stored subject.
50 * - audience: Stored audience.
51 * - expires: Stored expiration in unix timestamp.
52 * - jti: The stored jti.
53 */
54 public function getJti($client_id, $subject, $audience, $expiration, $jti);
55
56 /**
57 * Store a used jti so that we can check against it to prevent replay attacks.
58 * @param $client_id
59 * Client identifier to insert.
60 *
61 * @param $subject
62 * The subject to insert.
63 *
64 * @param $audience
65 * The audience to insert.
66 *
67 * @param $expiration
68 * The expiration of the jti.
69 *
70 * @param $jti
71 * The jti to insert.
72 */
73 public function setJti($client_id, $subject, $audience, $expiration, $jti);
74}