forked from JetBrains/phpstorm-stubs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoauth.php
372 lines (314 loc) · 8.11 KB
/
oauth.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
<?php
define('OAUTH_SIG_METHOD_RSASHA1', 'RSA-SHA1');
define('OAUTH_SIG_METHOD_HMACSHA1', 'HMAC-SHA1');
define('OAUTH_SIG_METHOD_HMACSHA256', 'HMAC-SHA256');
define('OAUTH_AUTH_TYPE_AUTHORIZATION', 3);
define('OAUTH_AUTH_TYPE_NONE', 2);
define('OAUTH_AUTH_TYPE_URI', 1);
define('OAUTH_AUTH_TYPE_FORM', 2);
define('OAUTH_HTTP_METHOD_GET', 'GET');
define('OAUTH_HTTP_METHOD_POST', 'POST');
define('OAUTH_HTTP_METHOD_PUT', 'PUT');
define('OAUTH_HTTP_METHOD_HEAD', 'HEAD');
define('OAUTH_HTTP_METHOD_DELETE', 'DELETE');
define('OAUTH_REQENGINE_STREAMS', 1);
define('OAUTH_REQENGINE_CURL', 2);
define('OAUTH_OK', 0);
define('OAUTH_BAD_NONCE', 4);
define('OAUTH_BAD_TIMESTAMP', 8);
define('OAUTH_CONSUMER_KEY_UNKNOWN', 16);
define('OAUTH_CONSUMER_KEY_REFUSED', 32);
define('OAUTH_INVALID_SIGNATURE', 64);
define('OAUTH_TOKEN_USED', 128);
define('OAUTH_TOKEN_EXPIRED', 256);
define('OAUTH_TOKEN_REJECTED', 1024);
define('OAUTH_VERIFIER_INVALID', 2048);
define('OAUTH_PARAMETER_ABSENT', 4096);
define('OAUTH_SIGNATURE_METHOD_REJECTED', 8192);
/**
* Generate a Signature Base String
*
* @param string $http_method
* @param string $uri
* @param array $request_parameters
* @return string
*/
function oauth_get_sbs($http_method, $uri, $request_parameters = array()) { }
/**
* Encode a URI to RFC 3986
*
* @param string $uri
* @return string
*/
function oauth_urlencode($uri) { }
/**
* The OAuth extension provides a simple interface to interact with data providers using the OAuth HTTP specification to protect private resources.
*/
class OAuth {
/**
* @var bool
*/
public $debug;
/**
* @var bool
*/
public $sslChecks;
/**
* @var array
*/
public $debugInfo;
/**
* Create a new OAuth object
* @param string $consumer_key
* @param string $consumer_secret
* @param string $signature_method
* @param int $auth_type
*/
public function __construct($consumer_key, $consumer_secret, $signature_method = OAUTH_SIG_METHOD_HMACSHA1, $auth_type = OAUTH_AUTH_TYPE_AUTHORIZATION) { }
/**
* Turn off verbose debugging
* @return bool
*/
public function disableDebug() { }
/**
* Turn off redirects
* @return void
*/
public function disableRedirects() { }
/**
* Turn off SSL checks
* @return bool
*/
public function disableSSLChecks() { }
/**
* Turn on verbose debugging
* @return bool
*/
public function enableDebug() { }
/**
* Turn on redirects
* @return bool
*/
public function enableRedirects() { }
/**
* Turn on SSL checks
* @return bool
*/
public function enableSSLChecks() { }
/**
* Set the timeout
* @param int $timeout Time in milliseconds
* @return void
*/
public function setTimeout($timeout) { }
/**
* Fetch an OAuth-protected resource
* @param string $protected_resource_url
* @param array $extra_parameters
* @param string $http_method
* @param array $http_headers
* @return mixed
*/
public function fetch($protected_resource_url, $extra_parameters = array(), $http_method = null, $http_headers = array()) { }
/**
* Fetch an access token
* @param string $access_token_url
* @param string $auth_session_handle
* @param string $verifier_token
* @return array
*/
public function getAccessToken($access_token_url, $auth_session_handle = null, $verifier_token = null) { }
/**
* Get CA information
* @return array
*/
public function getCAPath() { }
/**
* Get the last response
* @return string
*/
public function getLastResponse() { }
/**
* Get headers for last response
* @return string|false
*/
public function getLastResponseHeaders() { }
/**
* Get HTTP information about the last response
* @return array
*/
public function getLastResponseInfo() { }
/**
* Generate OAuth header string signature
* @param string $http_method
* @param string $url
* @param mixed $extra_parameters
* @return string|false
*/
public function getRequestHeader($http_method, $url, $extra_parameters = '') { }
/**
* Fetch a request token
* @param string $request_token_url
* @param string $callback_url
* @return array
*/
public function getRequestToken($request_token_url, $callback_url = null) { }
/**
* Set authorization type
* @param int $auth_type
* @return bool
*/
public function setAuthType($auth_type) { }
/**
* Set CA path and info
* @param string $ca_path
* @param string $ca_info
* @return mixed
*/
public function setCAPath($ca_path = null, $ca_info = null) { }
/**
* Set the nonce for subsequent requests
* @param string $nonce
* @return mixed
*/
public function setNonce($nonce) { }
/**
*
* @param int $reqengine
* @return void
*/
public function setRequestEngine($reqengine) { }
/**
* Set the RSA certificate
* @param string $cert
* @return mixed
*/
public function setRSACertificate($cert) { }
/**
* Set the timestamp
* @param string $timestamp
* @return mixed
*/
public function setTimestamp($timestamp) { }
/**
* Set the token and secret
* @param string $token
* @param string $token_secret
* @return bool
*/
public function setToken($token, $token_secret) { }
/**
* Set the OAuth version
* @param string $version
* @return bool
*/
public function setVersion($version) { }
}
/**
*
*/
class OAuthException extends Exception {
/**
* The response of the exception which occurred, if any
* @var string
*/
public $lastResponse;
/**
* @var array
*/
public $debugInfo;
}
;
/**
* Manages an OAuth provider class.
*/
class OAuthProvider {
/**
* @param string $req_params
* @return bool
*/
final public function addRequiredParameter($req_params) { }
/**
* @return void
*/
public function callconsumerHandler() { }
/**
* @return void
*/
public function callTimestampNonceHandler() { }
/**
* @return void
*/
public function calltokenHandler() { }
/**
* @param string $uri
* @param string $method
* @return void
*/
public function checkOAuthRequest($uri = '', $method = '') { }
/**
* @param array $params_array
* @return OAuthProvider
*/
public function __construct($params_array) { }
/**
* @param callback $callback_function
* @return void
*/
public function consumerHandler($callback_function) { }
/**
* @param int $size
* @param bool $strong
* @return string
* @static
* @final
*/
final public static function generateToken($size, $strong = false) { }
/**
* @param mixed $params_array
* @return void
*/
public function is2LeggedEndpoint($params_array) { }
/**
* @param bool $will_issue_request_token
* @return void
*/
public function isRequestTokenEndpoint($will_issue_request_token) { }
/**
* @param string
* @return bool
* @final
*/
final public function removeRequiredParameter($req_params) { }
/**
* @param string $oauthexception
* @param bool $send_headers
* @static
* @return string
* @final
*/
final public static function reportProblem($oauthexception, $send_headers = true) { }
/**
* @param string $param_key
* @param mixed $param_val
* @return bool
* @final
*/
final public function setParam($param_key, $param_val = null) { }
/**
* @param string $path
* @return bool
* @final
*/
final public function setRequestTokenPath($path) { }
/**
* @param callback $callback_function
* @return void
*/
public function timestampNonceHandler($callback_function) { }
/**
* @param callback $callback_function
* @return void
*/
public function tokenHandler($callback_function) { }
}