Permalink
Browse files

Merge branch 'wip-mdl-41843-m25' of git://github.com/rajeshtaneja/moo…

…dle into MOODLE_25_STABLE
  • Loading branch information...
2 parents 2f334c6 + 6b3870a commit 88401c3494ae59af99de7c305140ff4281ae827b @stronk7 stronk7 committed Oct 13, 2013
Showing with 8 additions and 8 deletions.
  1. +2 −2 mod/lti/OAuth.php
  2. +6 −6 mod/lti/OAuthBody.php
View
@@ -181,15 +181,15 @@ protected function fetch_public_cert(&$request) {
// (3) some sort of specific discovery code based on request
//
// either way should return a string representation of the certificate
- throw Exception("fetch_public_cert not implemented");
+ throw OAuthException("fetch_public_cert not implemented");
}
protected function fetch_private_cert(&$request) {
// not implemented yet, ideas are:
// (1) do a lookup in a table of trusted certs keyed off of consumer
//
// either way should return a string representation of the certificate
- throw Exception("fetch_private_cert not implemented");
+ throw OAuthException("fetch_private_cert not implemented");
}
public function build_signature(&$request, $consumer, $token) {
View
@@ -85,7 +85,7 @@ function handleOAuthBodyPOST($oauth_consumer_key, $oauth_consumer_secret, $body,
// Must reject application/x-www-form-urlencoded
if (isset($request_headers['Content-type'])) {
if ($request_headers['Content-type'] == 'application/x-www-form-urlencoded' ) {
- throw new Exception("OAuth request body signing must not use application/x-www-form-urlencoded");
+ throw new OAuthException("OAuth request body signing must not use application/x-www-form-urlencoded");
}
}
@@ -99,7 +99,7 @@ function handleOAuthBodyPOST($oauth_consumer_key, $oauth_consumer_secret, $body,
}
if ( ! isset($oauth_body_hash) ) {
- throw new Exception("OAuth request body signing requires oauth_body_hash body");
+ throw new OAuthException("OAuth request body signing requires oauth_body_hash body");
}
// Verify the message signature
@@ -116,7 +116,7 @@ function handleOAuthBodyPOST($oauth_consumer_key, $oauth_consumer_secret, $body,
$server->verify_request($request);
} catch (Exception $e) {
$message = $e->getMessage();
- throw new Exception("OAuth signature failed: " . $message);
+ throw new OAuthException("OAuth signature failed: " . $message);
}
$postdata = $body;
@@ -125,7 +125,7 @@ function handleOAuthBodyPOST($oauth_consumer_key, $oauth_consumer_secret, $body,
$hash = base64_encode(sha1($postdata, TRUE));
if ( $hash != $oauth_body_hash ) {
- throw new Exception("OAuth oauth_body_hash mismatch");
+ throw new OAuthException("OAuth oauth_body_hash mismatch");
}
return $postdata;
@@ -155,11 +155,11 @@ function sendOAuthBodyPOST($method, $endpoint, $oauth_consumer_key, $oauth_consu
$ctx = stream_context_create($params);
$fp = @fopen($endpoint, 'rb', false, $ctx);
if (!$fp) {
- throw new Exception("Problem with $endpoint, $php_errormsg");
+ throw new OAuthException("Problem with $endpoint, $php_errormsg");
}
$response = @stream_get_contents($fp);
if ($response === false) {
- throw new Exception("Problem reading data from $endpoint, $php_errormsg");
+ throw new OAuthException("Problem reading data from $endpoint, $php_errormsg");
}
return $response;
}

0 comments on commit 88401c3

Please sign in to comment.