25 $this->signature_methods[$signature_method->get_name()] = $signature_method;
46 $callback =
$request->get_parameter(
'oauth_callback');
47 $new_token = $this->data_store->new_request_token($consumer, $callback);
69 $verifier =
$request->get_parameter(
'oauth_verifier');
70 $new_token = $this->data_store->new_access_token(
$token, $consumer, $verifier);
86 return array($consumer,
$token);
103 throw new OAuthException(
"OAuth version '$version' not supported");
116 ?
$request->get_parameter(
'oauth_signature_method') : NULL;
118 if (!$signature_method) {
121 throw new OAuthException(
'No signature method parameter. This parameter is required');
124 if (!in_array($signature_method,
125 array_keys($this->signature_methods))) {
127 "Signature method '$signature_method' not supported " .
128 'try one of the following: ' .
129 implode(
', ', array_keys($this->signature_methods))
133 return $this->signature_methods[$signature_method];
143 ?
$request->get_parameter(
'oauth_consumer_key') : NULL;
145 if (!$consumer_key) {
149 $consumer = $this->data_store->lookup_consumer($consumer_key);
164 ?
$request->get_parameter(
'oauth_token') : NULL;
166 $token = $this->data_store->lookup_token($consumer, $token_type, $token_field);
168 throw new OAuthException(
"Invalid $token_type token: $token_field");
183 ?
$request->get_parameter(
'oauth_timestamp')
186 ?
$request->get_parameter(
'oauth_nonce')
194 $signature =
$request->get_parameter(
'oauth_signature');
195 $valid_sig = $signature_method->check_signature(
$request, $consumer,
$token, $signature);
207 throw new OAuthException(
'Missing timestamp parameter. The parameter is required');
211 if (abs($now -
$timestamp) > $this->timestamp_threshold) {
212 throw new OAuthException(
"Expired timestamp, yours $timestamp, ours $now");
223 throw new OAuthException(
'Missing nonce parameter. The parameter is required');
226 $found = $this->data_store->lookup_nonce($consumer,
$token, $nonce,
$timestamp);
verify_request(&$request)
verify an api call, checks all the parameters
check_timestamp($timestamp)
check that the timestamp is new enough
foreach($paths as $path) $request
Class to represent an OAuth Exception.
check_signature($request, $consumer, $token)
all-in-one function to check the signature on a request should guess the signature method appropriate...
get_token($request, $consumer, $token_type="access")
try to find the token for the provided request's token key
fetch_request_token(&$request)
process a request_token request returns the request token on success
get_version(&$request)
version 1
get_consumer($request)
try to find the consumer for the provided request's consumer key
check_nonce($consumer, $token, $nonce, $timestamp)
check that the nonce is not repeated
get_signature_method($request)
figure out the signature with some defaults
Class to represent an OAuth Request.
foreach($mandatory_scripts as $file) $timestamp
Class to represent an OAuth Server.
fetch_access_token(&$request)
process an access_token request returns the access token on success
add_signature_method($signature_method)