Skip to content

Adding backslashes to the OAuthException calls for the appropriate na… #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/MaxCDN/OAuth/OAuthServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private function get_version(&$request) {
$version = '1.0';
}
if ($version !== $this->version) {
throw new OAuthException("OAuth version '$version' not supported");
throw new \OAuthException("OAuth version '$version' not supported");
}
return $version;
}
Expand All @@ -100,12 +100,12 @@ private function get_signature_method($request) {
if (!$signature_method) {
// According to chapter 7 ("Accessing Protected Ressources") the signature-method
// parameter is required, and we can't just fallback to PLAINTEXT
throw new OAuthException('No signature method parameter. This parameter is required');
throw new \OAuthException('No signature method parameter. This parameter is required');
}

if (!in_array($signature_method,
array_keys($this->signature_methods))) {
throw new OAuthException(
throw new \OAuthException(
"Signature method '$signature_method' not supported " .
"try one of the following: " .
implode(", ", array_keys($this->signature_methods))
Expand All @@ -123,12 +123,12 @@ private function get_consumer($request) {
: NULL;

if (!$consumer_key) {
throw new OAuthException("Invalid consumer key");
throw new \OAuthException("Invalid consumer key");
}

$consumer = $this->data_store->lookup_consumer($consumer_key);
if (!$consumer) {
throw new OAuthException("Invalid consumer");
throw new \OAuthException("Invalid consumer");
}

return $consumer;
Expand All @@ -146,7 +146,7 @@ private function get_token($request, $consumer, $token_type="access") {
$consumer, $token_type, $token_field
);
if (!$token) {
throw new OAuthException("Invalid $token_type token: $token_field");
throw new \OAuthException("Invalid $token_type token: $token_field");
}
return $token;
}
Expand Down Expand Up @@ -178,7 +178,7 @@ private function check_signature($request, $consumer, $token) {
);

if (!$valid_sig) {
throw new OAuthException("Invalid signature");
throw new \OAuthException("Invalid signature");
}
}

Expand All @@ -187,14 +187,14 @@ private function check_signature($request, $consumer, $token) {
*/
private function check_timestamp($timestamp) {
if( ! $timestamp )
throw new OAuthException(
throw new \OAuthException(
'Missing timestamp parameter. The parameter is required'
);

// verify that timestamp is recentish
$now = time();
if (abs($now - $timestamp) > $this->timestamp_threshold) {
throw new OAuthException(
throw new \OAuthException(
"Expired timestamp, yours $timestamp, ours $now"
);
}
Expand All @@ -205,7 +205,7 @@ private function check_timestamp($timestamp) {
*/
private function check_nonce($consumer, $token, $nonce, $timestamp) {
if( ! $nonce )
throw new OAuthException(
throw new \OAuthException(
'Missing nonce parameter. The parameter is required'
);

Expand All @@ -217,7 +217,7 @@ private function check_nonce($consumer, $token, $nonce, $timestamp) {
$timestamp
);
if ($found) {
throw new OAuthException("Nonce already used: $nonce");
throw new \OAuthException("Nonce already used: $nonce");
}
}

Expand Down