1 | <?php |
||
17 | class Introspector |
||
18 | { |
||
19 | /** |
||
20 | * @var AccessTokenRepositoryInterface |
||
21 | */ |
||
22 | private $accessTokenRepository; |
||
23 | |||
24 | /** |
||
25 | * @var CryptKey |
||
26 | */ |
||
27 | private $privateKey; |
||
28 | |||
29 | /** |
||
30 | * @var Parser |
||
31 | */ |
||
32 | private $parser; |
||
33 | |||
34 | /** |
||
35 | * New Introspector instance. |
||
36 | * |
||
37 | * @param AccessTokenRepositoryInterface $accessTokenRepository |
||
38 | * @param CryptKey $privateKey |
||
39 | * @param Parser $parser |
||
40 | */ |
||
41 | 5 | public function __construct( |
|
50 | |||
51 | /** |
||
52 | * Return an introspection response. |
||
53 | * |
||
54 | * @param ServerRequestInterface $request |
||
55 | * |
||
56 | * @return IntrospectionResponse |
||
57 | */ |
||
58 | 5 | public function respondToIntrospectionRequest( |
|
75 | |||
76 | /** |
||
77 | * Validate the JWT and make sure it has not expired or been revoked |
||
78 | * |
||
79 | * @return bool |
||
80 | */ |
||
81 | 4 | private function isTokenValid(Token $token) |
|
85 | |||
86 | /** |
||
87 | * Validate the JWT token. |
||
88 | * |
||
89 | * @param Token $token |
||
90 | * |
||
91 | * @return bool |
||
92 | */ |
||
93 | 4 | private function verifyToken(Token $token) |
|
100 | |||
101 | /** |
||
102 | * Ensure access token hasn't expired |
||
103 | * |
||
104 | * @param Token $token |
||
105 | * |
||
106 | * @return bool |
||
107 | */ |
||
108 | 3 | private function isTokenExpired(Token $token) |
|
114 | |||
115 | /** |
||
116 | * Check if the given access token is revoked. |
||
117 | * |
||
118 | * @param Token $token |
||
119 | * |
||
120 | * @return bool |
||
121 | */ |
||
122 | 2 | private function isTokenRevoked(Token $token) |
|
126 | |||
127 | /** |
||
128 | * Create active introspection response. |
||
129 | * |
||
130 | * @param Token $token |
||
131 | * |
||
132 | * @return IntrospectionResponse |
||
133 | */ |
||
134 | 1 | private function setTokenOnResponse(Token $token, IntrospectionResponse $responseType) |
|
140 | } |
||
141 |