diff --git a/src/MaxCDN/OAuth/OAuthServer.php b/src/MaxCDN/OAuth/OAuthServer.php index 9379c33..7d284d4 100644 --- a/src/MaxCDN/OAuth/OAuthServer.php +++ b/src/MaxCDN/OAuth/OAuthServer.php @@ -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; } @@ -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)) @@ -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; @@ -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; } @@ -178,7 +178,7 @@ private function check_signature($request, $consumer, $token) { ); if (!$valid_sig) { - throw new OAuthException("Invalid signature"); + throw new \OAuthException("Invalid signature"); } } @@ -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" ); } @@ -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' ); @@ -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"); } }