1 | <?php |
||
19 | abstract class AbstractAuthentication implements AuthenticationInterface |
||
20 | { |
||
21 | /** |
||
22 | * URI for requesting and refreshing tokens. |
||
23 | */ |
||
24 | const AUTHENTICATION_URI = 'oauth/token'; |
||
25 | |||
26 | /** |
||
27 | * Refresh token grant type. |
||
28 | */ |
||
29 | const REFRESH_GRANT_TYPE = 'refresh_token'; |
||
30 | |||
31 | /** |
||
32 | * HTTP Client for making authentication requests. |
||
33 | * |
||
34 | * @var ClientInterface |
||
35 | */ |
||
36 | protected $client; |
||
37 | |||
38 | /** |
||
39 | * Access token for the API. |
||
40 | * |
||
41 | * @var string |
||
42 | */ |
||
43 | protected $accessToken; |
||
44 | |||
45 | /** |
||
46 | * Refresh token to referesh the access token. |
||
47 | * |
||
48 | * @var string |
||
49 | */ |
||
50 | protected $refreshToken; |
||
51 | |||
52 | /** |
||
53 | * Client ID for the API. |
||
54 | * |
||
55 | * @var string |
||
56 | */ |
||
57 | protected $clientId; |
||
58 | |||
59 | /** |
||
60 | * Base url for the api. |
||
61 | * |
||
62 | * @var string |
||
63 | */ |
||
64 | protected $baseUrl; |
||
65 | |||
66 | /** |
||
67 | * {@inheritdoc} |
||
68 | */ |
||
69 | public function __construct(ClientInterface $client) |
||
73 | |||
74 | /** |
||
75 | * {@inheritdoc} |
||
76 | */ |
||
77 | public function getAccessToken() |
||
81 | |||
82 | /** |
||
83 | * Gets the value of clientId. |
||
84 | * |
||
85 | * @return string |
||
86 | */ |
||
87 | public function getClientId() |
||
91 | |||
92 | /** |
||
93 | * Sets the value of clientId. |
||
94 | * |
||
95 | * @param string $clientId Value to set |
||
96 | * |
||
97 | * @return self |
||
98 | */ |
||
99 | public function setClientId($clientId) |
||
105 | |||
106 | /** |
||
107 | * Gets the value of baseUrl. |
||
108 | * |
||
109 | * @return mixed |
||
110 | */ |
||
111 | public function getBaseUrl() |
||
115 | |||
116 | /** |
||
117 | * Sets the value of baseUrl. |
||
118 | * |
||
119 | * @param mixed $baseUrl Value to set |
||
120 | * |
||
121 | * @return self |
||
122 | */ |
||
123 | public function setBaseUrl($baseUrl) |
||
129 | |||
130 | /** |
||
131 | * Returns the url where authentication tokens can be retrieved. |
||
132 | * |
||
133 | * @return string |
||
134 | */ |
||
135 | public function getAuthenticationUrl() |
||
139 | } |
||
140 |