Repository navigation
Add inbound LTI 1.3 registrations and use a complete one for launch #396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
e4218aa
57f9e0d
fe5b353
fce1cbe
79272db
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -91,7 +91,6 @@ reviews: | |
| tools: | ||
| phpstan: | ||
| enabled: true | ||
| config_file: "phpstan.neon" | ||
| phpcs: | ||
| enabled: false | ||
| phpmd: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| --- | ||
| description: Do not push CodeRabbit fixes until the user has seen the diff | ||
| alwaysApply: true | ||
| --- | ||
|
|
||
| # CodeRabbit fixes stay local | ||
|
|
||
| When the work is fixing CodeRabbit comments, do not push the branch. | ||
|
|
||
| Make the changes and stop. Leave them unpushed so the user can read the diff. A CodeRabbit review, a red check, or "fix the comments" is not permission to push, force-push, or open a pull request. | ||
|
|
||
| Push only after the user explicitly says to push in that conversation, once they have seen what changed. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,12 +16,15 @@ | |
| $rows = $PDOX->queryDie($patch_sql); | ||
|
|
||
| $query_parms = array(); | ||
| $searchfields = array("K.key_id", "key_title", "key_key", "deploy_key", "K.login_at", "K.updated_at", "K.user_id", "K.lms_client"); | ||
| $searchfields = array("K.key_id", "key_title", "key_key", "deploy_key", "K.login_at", "K.updated_at", "K.user_id", "K.lms_client", "R.issuer", "R.client_id"); | ||
| $sql = "SELECT K.key_id AS key_id, key_title, key_key, secret, lms_issuer, K.lms_client AS lms_client, | ||
| lms_oidc_auth, lms_keyset_url, lms_token_url, | ||
| deploy_key, K.login_at AS login_at, K.updated_at as updated_at, | ||
| K.user_id AS user_id | ||
| K.user_id AS user_id, K.lti_registration_id AS lti_registration_id, | ||
| R.issuer AS registration_issuer, R.client_id AS registration_client | ||
| FROM {$CFG->dbprefix}lti_key AS K | ||
| LEFT JOIN {$CFG->dbprefix}lti_registration AS R | ||
| ON R.lti_registration_id = K.lti_registration_id | ||
| "; | ||
|
|
||
| $newsql = Table::pagedQuery($sql, $query_parms, $searchfields); | ||
|
|
@@ -34,8 +37,13 @@ | |
| $newrow['key'] = $row['key_key']; | ||
| if ( !empty($row['key_title']) ) $newrow['key'] = $row['key_title']; | ||
| $newrow['key_type'] = \Tsugi\Services\Admin\AdminService::keyTypeLabel($row); | ||
| $newrow['_html_key_type'] = \Tsugi\Services\Admin\AdminService::keyTypeHtml($row); | ||
| $issuer_key = $row['lms_issuer']; | ||
| $client_id = $row['lms_client']; | ||
| if ( empty($issuer_key) && empty($client_id) && ! empty($row['registration_issuer']) ) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Display the platform identity that launch uses. If a key retains platform A and links to a complete registration for platform B, this condition displays A. Launch uses B even when the key fields remain populated. Apply the runtime completeness and precedence rule to this display. Keep the key identity when the registration is incomplete. (raw.githubusercontent.com)
|
||
| $issuer_key = $row['registration_issuer']; | ||
| $client_id = $row['registration_client']; | ||
| } | ||
| $issuer_display = ''; | ||
| if ( !empty($issuer_key) || !empty($client_id) ) { | ||
| if ( !empty($issuer_key) ) { | ||
|
|
@@ -64,9 +72,10 @@ | |
| $OUTPUT->flashMessages(); | ||
| echo \Tsugi\Services\Admin\AdminService::clientIdCheckNotices(); | ||
| ?> | ||
| <h1>LTI Tenants (Keys)</h1> | ||
| <h1>Keys / Deployments</h1> | ||
| <p> | ||
| <a href="<?= LTIX::curPageUrlFolder() ?>" class="btn btn-default active">Tenant Keys</a> | ||
| <a href="registrations" class="btn btn-default">Registrations</a> | ||
| <a href="<?= LTIX::curPageUrlFolder() ?>" class="btn btn-default active">Keys</a> | ||
| <?php if ( $CFG->providekeys ) { ?> | ||
| <a href="requests" class="btn btn-default">Key Requests</a> | ||
| <?php } ?> | ||
|
|
@@ -75,11 +84,12 @@ | |
| </p> | ||
| <?php if ( count($newrows) < 1 ) { ?> | ||
| <p> | ||
| You have no Tenant keys for this system. | ||
| You have no keys for this system. | ||
| </p> | ||
| <?php } | ||
| $extra_buttons = array( | ||
| "Insert Tenant" => "key-add" | ||
| "Insert Registration" => "registration-add", | ||
| "Insert Key" => "key-add" | ||
| ); | ||
| Table::pagedTable($newrows, $searchfields, false, "key-detail", false, $extra_buttons); | ||
| // echo("<pre>\n");print_r($newrows);echo("</pre>\n"); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,13 +17,12 @@ | |
|
|
||
| $from_location = LTIX::curPageUrlFolder(); | ||
| $tablename = "{$CFG->dbprefix}lti_key"; | ||
| $fields = array('key_title', 'plus', 'key_key', 'key_sha256', 'secret', | ||
| $fields = array('key_title', 'plus', 'user_id', 'key_key', 'key_sha256', 'secret', | ||
| 'lms_issuer', 'lms_issuer_sha256', | ||
| 'lms_client', | ||
| 'deploy_key', 'deploy_sha256', | ||
| 'lms_oidc_auth', 'lms_keyset_url', 'lms_token_url', 'lms_token_audience', | ||
| 'created_at', 'updated_at', | ||
| 'user_id', | ||
| ); | ||
|
|
||
| $titles = array( | ||
|
|
@@ -65,6 +64,10 @@ | |
| } | ||
|
|
||
| if ( isset($_POST['doSave']) && count($_POST) > 0 ) { | ||
| if ( ! \Tsugi\Services\Admin\AdminService::applyPostedRegistrationToKey() ) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Validate the effective identity before inserting the key. If an existing key uses issuer I, client C and deployment D, selecting its complete registration and clearing the new key fields bypasses duplicate validation. The helper clears issuer/client before The insert can create another matching key, but launch selects the lowest matching
|
||
| header("Location: key-add"); | ||
| return; | ||
| } | ||
| $lms_issuer = U::get($_POST, 'lms_issuer'); | ||
| $lms_client = U::get($_POST, 'lms_client'); | ||
| $identity_message = LTI::ascii255First(array( | ||
|
|
@@ -99,7 +102,9 @@ | |
| if ( isset($_POST['doSave']) ) { | ||
| $binaryHex['guid'] = \Tsugi\Core\Guid::uuid7(); | ||
| } | ||
| $retval = CrudForm::handleInsert($tablename, $fields, $binaryHex); | ||
| $save_fields = $fields; | ||
| $save_fields[] = 'lti_registration_id'; | ||
| $retval = CrudForm::handleInsert($tablename, $save_fields, $binaryHex); | ||
| if ( $retval == CrudForm::CRUD_SUCCESS || $retval == CrudForm::CRUD_FAIL ) { | ||
| header("Location: $from_location"); | ||
| return; | ||
|
|
@@ -111,7 +116,7 @@ | |
| $OUTPUT->flashMessages(); | ||
|
|
||
| ?> | ||
| <h1>Adding Tsugi Tenant/Key | ||
| <h1>Adding Key | ||
| <a class="btn btn-default" href="<?= LTIX::curPageUrlFolder() ?>">Exit</a> | ||
| </h1> | ||
| <ul class="nav nav-tabs"> | ||
|
|
@@ -129,29 +134,32 @@ | |
| or this form. Tsugi solves this with a concept called "Draft Keys" where you can create a key | ||
| with minimal information and then edit it later (perhaps by dynamic registration) to fill in the | ||
| remaining details. For LTI 1.3, you can leave <b>LTI 1.3 Deployment Id</b> blank so the key accepts any value from the LMS; launches then | ||
| match on issuer and client id only. Set a specific value when you want this tenant to accept only | ||
| match on issuer and client id only. Set a specific value when you want this key to accept only | ||
| that deployment. Dynamic registration can still fill in or change deployment later. | ||
| </p> | ||
| <p> | ||
| See "About Keys" tab for detail on how to create a <b>draft</b> key. | ||
| To keep the platform values on a registration instead, create one by hand and choose it here. | ||
| After you choose a registration, leave the platform fields on this key, or check the box to empty them and keep the deployment id only. | ||
| </p> | ||
| <?php | ||
|
|
||
| CrudForm::insertForm($fields, $from_location, $titles, false, array('plus')); | ||
| $registration_html = \Tsugi\Services\Admin\AdminService::inboundRegistrationControl(0, true); | ||
| CrudForm::insertForm($fields, $from_location, $titles, false, array('plus'), array('secret' => $registration_html)); | ||
|
|
||
| ?> | ||
| </p> | ||
| </div> | ||
| <div class="tab-pane fade" id="info"> | ||
| <h2>Tenant Key Options</h2> | ||
| <h2>Key Options</h2> | ||
| <p> | ||
| A single entry in this table defines a "distinct tenant" in Tsugi. | ||
| Data in Tsugi is isolated to a tenant. For a key to work it must have at least one of | ||
| A single entry in this table is one key. | ||
| Data in Tsugi is isolated to a key. For a key to work it must have at least one of | ||
| <ul> | ||
| <li>An LTI 1.1 <b>oauth_consumer_key</b> that must be unique in this system and | ||
| a <b>secret</b> | ||
| <li>For an LMS that supports LTI 1.3 and Dynamic Registration, enter the <b>issuer</b> and <b>unlock_key</b> | ||
| and leave the other fields blank. Optionally set <b>deployment_id</b> if you want this tenant to match only that deployment. | ||
| and leave the other fields blank. Optionally set <b>deployment_id</b> if you want this key to match only that deployment. | ||
| If you do not know the <b>deployment_id</b> or it will be set automatically later using Dynamic Registration, leave | ||
| <b>Deployment Id</b> blank to accept any value from the LMS, or enter a placeholder that you edit after registration. | ||
| </li> | ||
|
|
@@ -161,7 +169,7 @@ | |
| should be able to give you the rest of the values and you can come back and edit the entry here. | ||
| </li> | ||
| </ul> | ||
| Some tenants can have both LTI 1.1 and LTI 1.3 values if you want to have automatic conversion of accounts | ||
| Some keys can have both LTI 1.1 and LTI 1.3 values if you want to have automatic conversion of accounts | ||
| created in Tsugi using LTI 1.1 and letting them be converted to support LTI 1.3 without creating a second account. | ||
| </p> | ||
| <h2>LTI 1.3 Dynamic Registration</h2> | ||
|
|
@@ -182,8 +190,8 @@ | |
| </p> | ||
| <h2>LTI 1.1 to LTI 1.3 Migration</h2> | ||
| <p> | ||
| To receive both LTI 1.1 and LTI 1.3 launches to this "tenant", simply set all four fields. | ||
| If you are adding LTI 1.3 to a pre-existing LTI 1.1 tenant, the LMS must | ||
| To receive both LTI 1.1 and LTI 1.3 launches to this key, simply set all four fields. | ||
| If you are adding LTI 1.3 to a pre-existing LTI 1.1 key, the LMS must | ||
| support | ||
| LTI Advantage legacy LTI 1.1 support as described in the | ||
| <a href="http://www.imsglobal.org/spec/lti/v1p3/migr#lti-1-1-migration-claim" target="_blank"> | ||
|
|
@@ -220,7 +228,7 @@ | |
| </pre> | ||
| <h2>LTI 1.1</h2> | ||
| <p> | ||
| Create a Tenant key with the LTI key and secret. Then come back here and view the key to | ||
| Create a key with the LTI key and secret. Then come back here and view the key to | ||
| see the various URLs you can use to install Tsugi in your LMS. | ||
| </p> | ||
|
|
||
|
|
@@ -238,7 +246,7 @@ | |
| <?php require __DIR__ . '/plus-config.php'; ?> | ||
| <h2>LTI 1.1</h2> | ||
| <p> | ||
| Create a Tenant key with the LTI key and secret. Then come back here and view the key | ||
| Create a key with the LTI key and secret. Then come back here and view the key | ||
| to see the various URLs you can use to install Tsugi in Blackboard. | ||
| </p> | ||
| </div> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Document that configuration reads can log without a token request.
applyInboundRegistration()logs when it selects a complete registration. Grade and roster loaders call it before deciding whether they need a token. Describe the setting as logging registration-backed configuration reads; keep the existingfalseexample.