mirror of
https://github.com/moodle/moodle.git
synced 2025-01-31 12:45:04 +01:00
MDL-20534 lti: A4, add some todos towards unified Oauth
This commit is contained in:
parent
fccacaa785
commit
fabd4fcf53
@ -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);
|
||||
|
||||
|
@ -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'];
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user