1 | <?php |
||
15 | final class Bearer extends AbstractTokenService |
||
16 | { |
||
17 | /** @string Name of the authorization header injected into the request */ |
||
18 | const HEADER_AUTHORIZATION = 'Authorization'; |
||
19 | |||
20 | /** @string Access Token type */ |
||
21 | const TOKEN_TYPE = 'Bearer'; |
||
22 | |||
23 | /** |
||
24 | * @inheritdoc |
||
25 | */ |
||
26 | 6 | public function isAuthorized(RequestInterface $request): bool |
|
30 | |||
31 | /** |
||
32 | * @inheritdoc |
||
33 | */ |
||
34 | 2 | protected function requestAccessToken(): AccessToken |
|
38 | |||
39 | /** |
||
40 | * Returns an authorized copy of the request. Only gets called when necessary (i.e. not if the request is already |
||
41 | * authorized), and always with a valid (fresh) Access Token. However, it SHOULD be idempotent. |
||
42 | * |
||
43 | * @param RequestInterface $request An unauthorized request |
||
44 | * |
||
45 | * @return RequestInterface An authorized copy of the request |
||
46 | */ |
||
47 | 5 | protected function getAuthorizedRequest(RequestInterface $request): RequestInterface |
|
57 | |||
58 | /** |
||
59 | * @return string |
||
60 | */ |
||
61 | 5 | private function getAuthorizationString(): string |
|
65 | } |
||
66 |