MDL-20534 lti: A4, add some todos towards unified Oauth

This commit is contained in:
Eloy Lafuente (stronk7) 2011-11-07 01:10:30 +01:00 committed by Chris Scribner
parent fccacaa785
commit fabd4fcf53
3 changed files with 6 additions and 1 deletions

View File

@ -48,6 +48,7 @@
defined('MOODLE_INTERNAL') || die;
// TODO: Switch to core oauthlib once implemented - MDL-30149
use moodle\mod\lti as lti;
require_once($CFG->dirroot.'/mod/lti/OAuth.php');
@ -1052,9 +1053,9 @@ function lti_sign_parameters($oldparms, $endpoint, $method, $oauthconsumerkey, $
$testtoken = '';
// TODO: Switch to core oauthlib once implemented - MDL-30149
$hmacmethod = new lti\OAuthSignatureMethod_HMAC_SHA1();
$testconsumer = new lti\OAuthConsumer($oauthconsumerkey, $oauthconsumersecret, null);
$accreq = lti\OAuthRequest::from_consumer_and_token($testconsumer, $testtoken, $method, $endpoint, $parms);
$accreq->sign_request($hmacmethod, $testconsumer, $testtoken);

View File

@ -27,12 +27,14 @@ require_once(dirname(__FILE__) . "/../../config.php");
require_once($CFG->dirroot.'/mod/lti/locallib.php');
require_once($CFG->dirroot.'/mod/lti/servicelib.php');
// TODO: Switch to core oauthlib once implemented - MDL-30149
use moodle\mod\lti as lti;
$rawbody = file_get_contents("php://input");
foreach (getallheaders() as $name => $value) {
if ($name === 'Authorization') {
// TODO: Switch to core oauthlib once implemented - MDL-30149
$oauthparams = lti\OAuthUtil::split_header($value);
$consumerkey = $oauthparams['oauth_consumer_key'];

View File

@ -25,6 +25,7 @@
require_once($CFG->dirroot.'/mod/lti/OAuthBody.php');
// TODO: Switch to core oauthlib once implemented - MDL-30149
use moodle\mod\lti as lti;
define('LTI_ITEM_TYPE', 'mod');
@ -187,6 +188,7 @@ function lti_verify_message($key, $sharedsecrets, $body, $headers = null) {
$signaturefailed = false;
try {
// TODO: Switch to core oauthlib once implemented - MDL-30149
lti\handleOAuthBodyPOST($key, $secret, $body, $headers);
} catch (Exception $e) {
$signaturefailed = true;