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 | 1 | public function __construct( |
|
48 | |||
49 | /** |
||
50 | * Return an introspection response. |
||
51 | * |
||
52 | * @param ServerRequestInterface $request |
||
53 | * @param IntrospectionResponse $responseType |
||
54 | * |
||
55 | * @return IntrospectionResponse |
||
56 | */ |
||
57 | 1 | public function respondToIntrospectionRequest( |
|
73 | |||
74 | /** |
||
75 | * Validate the JWT and make sure it has not expired or been revoked |
||
76 | * |
||
77 | * @return bool |
||
78 | */ |
||
79 | private function isTokenValid(Token $token) |
||
83 | |||
84 | /** |
||
85 | * Validate the JWT token. |
||
86 | * |
||
87 | * @param Token $token |
||
88 | * |
||
89 | * @return bool |
||
90 | */ |
||
91 | private function verifyToken(Token $token) |
||
98 | |||
99 | /** |
||
100 | * Ensure access token hasn't expired |
||
101 | * |
||
102 | * @param Token $token |
||
103 | * |
||
104 | * @return bool |
||
105 | */ |
||
106 | private function isTokenExpired(Token $token) |
||
112 | |||
113 | /** |
||
114 | * Check if the given access token is revoked. |
||
115 | * |
||
116 | * @param Token $token |
||
117 | * |
||
118 | * @return bool |
||
119 | */ |
||
120 | private function isTokenRevoked(Token $token) |
||
124 | |||
125 | /** |
||
126 | * Create active introspection response. |
||
127 | * |
||
128 | * @param Token $token |
||
129 | * |
||
130 | * @return IntrospectionResponse |
||
131 | */ |
||
132 | private function setTokenOnResponse(Token $token, IntrospectionResponse $responseType) |
||
138 | } |
||
139 |