1 | <?php |
||
15 | class BearerTokenValidator implements IntrospectionValidatorInterface |
||
16 | { |
||
17 | /** |
||
18 | * @var AccessTokenRepositoryInterface |
||
19 | */ |
||
20 | private $accessTokenRepository; |
||
21 | |||
22 | /** |
||
23 | * @var \League\OAuth2\Server\CryptKey |
||
24 | */ |
||
25 | protected $privateKey; |
||
26 | |||
27 | /** |
||
28 | * @param AccessTokenRepositoryInterface $accessTokenRepository |
||
29 | */ |
||
30 | 4 | public function __construct(AccessTokenRepositoryInterface $accessTokenRepository) |
|
34 | |||
35 | /** |
||
36 | * Set the private key. |
||
37 | * |
||
38 | * @param \League\OAuth2\Server\CryptKey $key |
||
39 | */ |
||
40 | 2 | public function setPrivateKey(CryptKey $key) |
|
44 | |||
45 | /** |
||
46 | * {@inheritdoc} |
||
47 | */ |
||
48 | 5 | public function validateIntrospection(ServerRequestInterface $request) |
|
66 | |||
67 | /** |
||
68 | * Gets the token from the request body. |
||
69 | * |
||
70 | * @param ServerRequestInterface $request |
||
71 | * |
||
72 | * @return Token |
||
73 | */ |
||
74 | public function getTokenFromRequest(ServerRequestInterface $request) |
||
81 | |||
82 | /** |
||
83 | * Checks whether the token is unverified. |
||
84 | * |
||
85 | * @param Token $token |
||
86 | * |
||
87 | * @return bool |
||
88 | */ |
||
89 | 2 | private function isTokenUnverified(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 token is revoked. |
||
117 | * |
||
118 | * @param Token $token |
||
119 | * |
||
120 | * @return bool |
||
121 | */ |
||
122 | 4 | private function isTokenRevoked(Token $token) |
|
126 | } |
||
127 |