1 | <?php |
||
11 | class xREL extends AbstractProvider |
||
12 | { |
||
13 | use BearerAuthorizationTrait; |
||
14 | |||
15 | /** |
||
16 | * Get authorization url to begin OAuth flow. |
||
17 | * |
||
18 | * @return string |
||
19 | */ |
||
20 | 9 | public function getBaseAuthorizationUrl() |
|
24 | |||
25 | /** |
||
26 | * Get access token url to retrieve token. |
||
27 | * |
||
28 | * @param array $params |
||
29 | * |
||
30 | * @return string |
||
31 | */ |
||
32 | 12 | public function getBaseAccessTokenUrl(array $params) |
|
36 | |||
37 | /** |
||
38 | * Get provider url to fetch user details. |
||
39 | * |
||
40 | * @param AccessToken $token |
||
41 | * |
||
42 | * @return string |
||
43 | */ |
||
44 | 6 | public function getResourceOwnerDetailsUrl(AccessToken $token) |
|
48 | |||
49 | /** |
||
50 | * Get the default scopes used by this provider. |
||
51 | * |
||
52 | * @return array |
||
53 | */ |
||
54 | 6 | protected function getDefaultScopes() |
|
58 | |||
59 | /** |
||
60 | * Check a provider response for errors. |
||
61 | * |
||
62 | * @param ResponseInterface $response |
||
63 | * @param array|string $data |
||
64 | * |
||
65 | * @throws IdentityProviderException |
||
66 | */ |
||
67 | 9 | protected function checkResponse(ResponseInterface $response, $data) |
|
68 | { |
||
69 | 9 | if ($response->getStatusCode() >= 400 || isset($data['error_type'])) { |
|
70 | 3 | throw new IdentityProviderException( |
|
71 | 3 | $data['error'] ?: $response->getReasonPhrase(), |
|
72 | 3 | $response->getStatusCode() ?: 0, |
|
73 | $data |
||
74 | ); |
||
75 | } |
||
76 | 9 | } |
|
77 | |||
78 | /** |
||
79 | * Generate a user object from a successful user details request. |
||
80 | * |
||
81 | * @param array $response |
||
82 | * @param AccessToken $token |
||
83 | * |
||
84 | * @return League\OAuth2\Client\Provider\ResourceOwnerInterface |
||
85 | */ |
||
86 | 3 | protected function createResourceOwner(array $response, AccessToken $token) |
|
90 | } |
||
91 |