mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 17:36:38 +02:00
MDL-70689 oauth2: self-register IMS OBv2.1 services
IMS OBv2.1 services have a registration endpoint to get client id and secret. This patch adds and implements the "register" method for the IMS Open Badges Connect discovery system, to get the proper client id and secret values.
This commit is contained in:
parent
84e51fb0fd
commit
9941e04857
4 changed files with 102 additions and 2 deletions
|
@ -103,13 +103,11 @@ class issuer extends persistent {
|
|||
|
||||
// Client ID.
|
||||
$mform->addElement('text', 'clientid', get_string('issuerclientid', 'tool_oauth2'));
|
||||
$mform->addRule('clientid', null, 'required', null, 'client');
|
||||
$mform->addRule('clientid', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
|
||||
$mform->addHelpButton('clientid', 'issuerclientid', 'tool_oauth2');
|
||||
|
||||
// Client Secret.
|
||||
$mform->addElement('text', 'clientsecret', get_string('issuerclientsecret', 'tool_oauth2'));
|
||||
$mform->addRule('clientsecret', null, 'required', null, 'client');
|
||||
$mform->addRule('clientsecret', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
|
||||
$mform->addHelpButton('clientsecret', 'issuerclientsecret', 'tool_oauth2');
|
||||
|
||||
|
@ -167,6 +165,13 @@ class issuer extends persistent {
|
|||
$mform->addHelpButton('requireconfirmation', 'issuerrequireconfirmation', 'tool_oauth2');
|
||||
}
|
||||
|
||||
if ($this->type == 'imsobv2p1' || $issuer->get('servicetype') == 'imsobv2p1') {
|
||||
$mform->addRule('baseurl', null, 'required', null, 'client');
|
||||
} else {
|
||||
$mform->addRule('clientid', null, 'required', null, 'client');
|
||||
$mform->addRule('clientsecret', null, 'required', null, 'client');
|
||||
}
|
||||
|
||||
$mform->addElement('hidden', 'sortorder');
|
||||
$mform->setType('sortorder', PARAM_INT);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue