mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 09:26:35 +02:00
MDL-66920 mod_lti: Allow usage of both JWKS URI and Public Key
- Changed mod_lti edit_form.php to add necessary fields. - Added configuration field 'keytype' that can be RSA_KEY or JWK_KEYSET, defaulting to RSA_KEY if none is found. - Changed mod_lti locallib.php to add the usage of jwk in the verifications of jwt's. - Changed mod_lti token.php to call the verification function from locallib.php. - Caches the keyset endpoint content of any given lti tool. - Updated language files to accommodate new functionalities. - Added test method for JWK functionalities. - Added test_keyset file in the fixtures folder. - Bumped the mod_lti version to 2020022200.
This commit is contained in:
parent
a2a13f2786
commit
32591786d9
8 changed files with 181 additions and 20 deletions
|
@ -129,12 +129,30 @@ class mod_lti_edit_types_form extends moodleform {
|
|||
$mform->setType('lti_clientid', PARAM_TEXT);
|
||||
}
|
||||
|
||||
$mform->addElement('textarea', 'lti_publickey', get_string('publickey', 'lti'), array('rows' => 8, 'cols' => 60));
|
||||
$keyoptions = [
|
||||
LTI_RSA_KEY => get_string('keytype_rsa', 'lti'),
|
||||
LTI_JWK_KEYSET => get_string('keytype_keyset', 'lti'),
|
||||
];
|
||||
$mform->addElement('select', 'lti_keytype', get_string('keytype', 'lti'), $keyoptions);
|
||||
$mform->setType('lti_keytype', PARAM_TEXT);
|
||||
$mform->addHelpButton('lti_keytype', 'keytype', 'lti');
|
||||
$mform->setDefault('lti_keytype', LTI_JWK_KEYSET);
|
||||
$mform->hideIf('lti_keytype', 'lti_ltiversion', 'neq', LTI_VERSION_1P3);
|
||||
|
||||
$mform->addElement('textarea', 'lti_publickey', get_string('publickey', 'lti'), ['rows' => 8, 'cols' => 60]);
|
||||
$mform->setType('lti_publickey', PARAM_TEXT);
|
||||
$mform->addHelpButton('lti_publickey', 'publickey', 'lti');
|
||||
$mform->hideIf('lti_publickey', 'lti_keytype', 'neq', LTI_RSA_KEY);
|
||||
$mform->hideIf('lti_publickey', 'lti_ltiversion', 'neq', LTI_VERSION_1P3);
|
||||
$mform->setForceLtr('lti_publickey');
|
||||
|
||||
$mform->addElement('text', 'lti_publickeyset', get_string('publickeyset', 'lti'), ['size' => '64']);
|
||||
$mform->setType('lti_publickeyset', PARAM_TEXT);
|
||||
$mform->addHelpButton('lti_publickeyset', 'publickeyset', 'lti');
|
||||
$mform->hideIf('lti_publickeyset', 'lti_keytype', 'neq', LTI_JWK_KEYSET);
|
||||
$mform->hideIf('lti_publickeyset', 'lti_ltiversion', 'neq', LTI_VERSION_1P3);
|
||||
$mform->setForceLtr('lti_publickeyset');
|
||||
|
||||
$mform->addElement('text', 'lti_initiatelogin', get_string('initiatelogin', 'lti'), array('size' => '64'));
|
||||
$mform->setType('lti_initiatelogin', PARAM_URL);
|
||||
$mform->addHelpButton('lti_initiatelogin', 'initiatelogin', 'lti');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue