1 | <?php |
||
15 | class DigitalOcean extends AbstractProvider |
||
16 | { |
||
17 | use BearerAuthorizationTrait; |
||
18 | |||
19 | const ACCESS_TOKEN_RESOURCE_OWNER_ID = 'info.uuid'; |
||
20 | |||
21 | /** |
||
22 | * Get authorization url to begin OAuth flow |
||
23 | * |
||
24 | * @return string |
||
25 | */ |
||
26 | 6 | public function getBaseAuthorizationUrl() |
|
30 | |||
31 | /** |
||
32 | * Get access token url to retrieve token |
||
33 | * |
||
34 | * @param array $params |
||
35 | * |
||
36 | * @return string |
||
37 | */ |
||
38 | 12 | public function getBaseAccessTokenUrl(array $params) |
|
42 | |||
43 | /** |
||
44 | * Get provider url to fetch user details |
||
45 | * |
||
46 | * @param AccessToken $token |
||
47 | * |
||
48 | * @return string |
||
49 | */ |
||
50 | 3 | public function getResourceOwnerDetailsUrl(AccessToken $token) |
|
54 | |||
55 | /** |
||
56 | * Get the default scopes used by this provider. |
||
57 | * |
||
58 | * @return array |
||
59 | */ |
||
60 | 6 | protected function getDefaultScopes() |
|
64 | |||
65 | /** |
||
66 | * Check a provider response for errors. |
||
67 | * |
||
68 | * @param ResponseInterface $response |
||
69 | * @param array|string $data |
||
70 | * |
||
71 | * @throws IdentityProviderException |
||
72 | */ |
||
73 | 9 | protected function checkResponse(ResponseInterface $response, $data) |
|
83 | |||
84 | /** |
||
85 | * Generate a user object from a successful user details request. |
||
86 | * |
||
87 | * @param array $response |
||
88 | * @param AccessToken $token |
||
89 | * |
||
90 | * @return League\OAuth2\Client\Provider\ResourceOwnerInterface |
||
91 | */ |
||
92 | 3 | protected function createResourceOwner(array $response, AccessToken $token) |
|
96 | |||
97 | /** |
||
98 | * Creates an access token from a response. |
||
99 | * |
||
100 | * The grant that was used to fetch the response can be used to provide |
||
101 | * additional context. |
||
102 | * |
||
103 | * @param array $response |
||
104 | * @param AbstractGrant $grant |
||
105 | * @return AccessTokenInterface |
||
106 | */ |
||
107 | 6 | protected function createAccessToken(array $response, AbstractGrant $grant) |
|
111 | } |
||
112 |