1 | <?php |
||
25 | class RevokeTokenHandler implements EmitterAwareInterface |
||
|
|||
26 | { |
||
27 | use EmitterAwareTrait, CryptTrait, RequestValidatorTrait; |
||
28 | |||
29 | /** |
||
30 | * @var ClientRepositoryInterface |
||
31 | */ |
||
32 | protected $clientRepository; |
||
33 | |||
34 | /** |
||
35 | * @var AccessTokenRepositoryInterface |
||
36 | */ |
||
37 | private $accessTokenRepository; |
||
38 | |||
39 | /** |
||
40 | * @var RefreshTokenRepositoryInterface |
||
41 | */ |
||
42 | private $refreshTokenRepository; |
||
43 | |||
44 | /** |
||
45 | * @var bool |
||
46 | */ |
||
47 | private $canRevokeAccessTokens; |
||
48 | |||
49 | /** |
||
50 | * @var CryptKey |
||
51 | */ |
||
52 | protected $publicKey; |
||
53 | |||
54 | /** |
||
55 | * New handler instance. |
||
56 | * |
||
57 | * @param RefreshTokenRepositoryInterface $refreshTokenRepository |
||
58 | * @param CryptKey|string $publicKey |
||
59 | * @param bool $canRevokeAccessTokens |
||
60 | */ |
||
61 | 12 | public function __construct( |
|
75 | |||
76 | /** |
||
77 | * @return ClientRepositoryInterface |
||
78 | */ |
||
79 | 12 | public function getClientRepository() |
|
83 | |||
84 | /** |
||
85 | * @param ClientRepositoryInterface $clientRepository |
||
86 | */ |
||
87 | 12 | public function setClientRepository(ClientRepositoryInterface $clientRepository) |
|
91 | |||
92 | /** |
||
93 | * @param AccessTokenRepositoryInterface $accessTokenRepository |
||
94 | */ |
||
95 | 12 | public function setAccessTokenRepository(AccessTokenRepositoryInterface $accessTokenRepository) |
|
99 | |||
100 | /** |
||
101 | * @param RefreshTokenRepositoryInterface $refreshTokenRepository |
||
102 | */ |
||
103 | 12 | public function setRefreshTokenRepository(RefreshTokenRepositoryInterface $refreshTokenRepository) |
|
107 | |||
108 | /** |
||
109 | * Set the public key |
||
110 | * |
||
111 | * @param CryptKey $key |
||
112 | */ |
||
113 | public function setPublicKey(CryptKey $key) |
||
117 | |||
118 | /** |
||
119 | * Return the grant identifier that can be used in matching up requests. |
||
120 | * |
||
121 | * @return string |
||
122 | */ |
||
123 | 12 | public function getIdentifier() |
|
127 | |||
128 | /** |
||
129 | * Return a revoke token response. |
||
130 | * https://tools.ietf.org/html/rfc7009 |
||
131 | * |
||
132 | * @param ServerRequestInterface $request |
||
133 | * @param ResponseTypeInterface $response |
||
134 | * |
||
135 | * @throws OAuthServerException |
||
136 | * |
||
137 | * @return ResponseTypeInterface |
||
138 | */ |
||
139 | 12 | public function respondToRevokeTokenRequest(ServerRequestInterface $request, ResponseTypeInterface $response) |
|
188 | |||
189 | /** |
||
190 | * @param string $tokenParam |
||
191 | * @param string $clientId |
||
192 | * |
||
193 | * @return null|Token |
||
194 | */ |
||
195 | 6 | protected function readAsAccessToken($tokenParam, $clientId) |
|
216 | |||
217 | /** |
||
218 | * @param string $tokenParam |
||
219 | * @param string $clientId |
||
220 | * |
||
221 | * @return null|array |
||
222 | */ |
||
223 | 8 | protected function readAsRefreshToken($tokenParam, $clientId) |
|
240 | } |
||
241 |