1 | <?php |
||
15 | class Introspector |
||
16 | { |
||
17 | /** |
||
18 | * @var AccessTokenRepositoryInterface |
||
19 | */ |
||
20 | private $accessTokenRepository; |
||
21 | |||
22 | /** |
||
23 | * @var CryptKey |
||
24 | */ |
||
25 | private $privateKey; |
||
26 | |||
27 | /** |
||
28 | * @var Parser |
||
29 | */ |
||
30 | private $parser; |
||
31 | |||
32 | /** |
||
33 | * New Introspector instance. |
||
34 | * |
||
35 | * @param AccessTokenRepositoryInterface $accessTokenRepository |
||
36 | * @param CryptKey $privateKey |
||
37 | * @param Parser $parser |
||
38 | */ |
||
39 | 5 | public function __construct( |
|
48 | |||
49 | /** |
||
50 | * Return an introspection response. |
||
51 | * |
||
52 | * @param ServerRequestInterface $request |
||
53 | * |
||
54 | * @return IntrospectionResponse |
||
55 | */ |
||
56 | 5 | public function respondToIntrospectionRequest( |
|
72 | |||
73 | /** |
||
74 | * Validate the JWT and make sure it has not expired or been revoked |
||
75 | * |
||
76 | * @return bool |
||
77 | */ |
||
78 | 4 | private function isTokenValid(Token $token) |
|
82 | |||
83 | /** |
||
84 | * Validate the JWT token. |
||
85 | * |
||
86 | * @param Token $token |
||
87 | * |
||
88 | * @return bool |
||
89 | */ |
||
90 | 4 | private function verifyToken(Token $token) |
|
97 | |||
98 | /** |
||
99 | * Ensure access token hasn't expired |
||
100 | * |
||
101 | * @param Token $token |
||
102 | * |
||
103 | * @return bool |
||
104 | */ |
||
105 | 3 | private function isTokenExpired(Token $token) |
|
111 | |||
112 | /** |
||
113 | * Check if the given access token is revoked. |
||
114 | * |
||
115 | * @param Token $token |
||
116 | * |
||
117 | * @return bool |
||
118 | */ |
||
119 | 2 | private function isTokenRevoked(Token $token) |
|
123 | |||
124 | /** |
||
125 | * Create active introspection response. |
||
126 | * |
||
127 | * @param Token $token |
||
128 | * |
||
129 | * @return IntrospectionResponse |
||
130 | */ |
||
131 | 1 | private function setTokenOnResponse(Token $token, IntrospectionResponse $responseType) |
|
137 | } |
||
138 |