WordPress LTI Testing: Part 2

Reading Time: 5 minutes

Following on from WordPress LTI Testing: Part 1, the next steps I want to take are to understand better what’s in the LTI output from Moodle before I start making changes to code (for the sake of simplicity at the moment I’m going to stick to the LTI plugin written by Simon Booth and Stephen Vickers. I’ve worked on code that Stephen has written before. I have also forked some code from Lumen Learning as another reference implementation and which looks super-useful).

Stephen very helpfully wrote an LTI test harness during the CeLTIc projects available at: https://lti.tools/saltire/

It provides 2 useful functions – you can pretend to be a VLE (Tool Consumer) and connect to an external Tool Provider; also you can use it as a dummy Tool Provider and connect to it from an actual VLE.

Connecting from Moodle to the Test Harness

  1. Check the connection details in the Test Tool Provider screen at: https://lti.tools/saltire/
  2. Configure an External Tool in Moodle
    • Tool name: LTI Test Harness
    • Tool URL: https://lti.tools/saltire/tp
    • Consumer Key: <from https://lti.tools/saltire/>
    • Secret: <from https://lti.tools/saltire/>
    • Tool configuration usage: Show as preconfigured tool…
  3. Add an instance of the tool to a course and launch the tool.
  4. You will be directed to the test harness and can explore the services available from the Tool Consumer and the detail of the message. Outputs for my test below…

Services Available

  • Basic Outcomes
  • OAuth 2 Access Token
  • Tool Consumer Profile
  • Tool Proxy
  • Tool Settings
  • Names and Role Provisioning
  • Gradebook
  • Unofficial Extensions
  • Caliper Profile

Message Parameters

context_id=3
context_label=scot-lit
context_title=Scottish Literature
context_type=CourseSection
ext_lms=moodle-2
ext_user_username=<moodle_username>
launch_presentation_document_target=frame
launch_presentation_locale=en
launch_presentation_return_url=http://<mydomain>/moodle/mod/lti/return.php?course=3&launch_container=5&instanceid=3&sesskey=qqFWnt5PlT
lis_course_section_sourcedid=
lis_outcome_service_url=http://<mydomain>/moodle/mod/lti/service.php
lis_person_contact_email_primary=<myemail>
lis_person_name_family=User
lis_person_name_full=Admin User
lis_person_name_given=Admin
lis_person_sourcedid=
lis_result_sourcedid={"data":{"instanceid":"3","userid":"2","typeid":"2","launchid":1166559949},"hash":"5b82efb40569de30f2d41c548b60de0d3927b9327d32af2d98ffd917e1e8bff9"}
lti_message_type=basic-lti-launch-request
lti_version=LTI-1p0
oauth_callback=about:blank
oauth_consumer_key=jisc.ac.uk
oauth_nonce=34c87939f2d8597b0a52249658366133
oauth_signature=JU5ORPyAt0gCrqvGwjNc5TbJ5sc=
oauth_signature_method=HMAC-SHA1
oauth_timestamp=1516486977
oauth_version=1.0
resource_link_description=
resource_link_id=3
resource_link_title=LTI Test Harness
roles=Instructor,urn:lti:sysrole:ims/lis/Administrator,urn:lti:instrole:ims/lis/Administrator
tool_consumer_info_product_family_code=moodle
tool_consumer_info_version=2017051502
tool_consumer_instance_description=My education
tool_consumer_instance_guid=<mydomain>
tool_consumer_instance_name=My education
user_id=2

Notes

From the message above I can see that the following useful things are being sent:

  • ext_user_username – this is my Moodle username. In the case of our live Moodle instance this will be our University Username and what will make SSO work both from LTI and direct to WordPress. It’s an ‘ext_’ parameter though, so it’s an extension over and above the Basic Launch Data. So it’s not necessarily going to be being passed from other VLEs. Need to repeat the test above from a few other VLE platforms to see what they do and decide on the most reliable way to get this data in a way that will work across VLE platforms (some sort of concatenation / substitution or a custom parameter).
  • user_id – this is what is being currently used by the WP plugin to set up the user in WordPress – suspect on our Moodle this is the right username, but on Learn will be the batchUID value, which is a reference to our IDM.
  • context_label- this would normally be our course code in Moodle (matching our student record). Ideally this is what I want to use for the WP site slug. This code in both our VLEs is based on a course code plus instance information – so each year / semester of the course is a unique instance.
  • context_title-this is what I want to use as the Title for the WordPress blog.

Checking the code (includes/lib.php) shows that the plugin is designed to delete all blogs associated with a LTI Consumer configuration, which will be the rationale behind making the WP site slug the same as the Consumer Key. Not sure that this is functionality that I need though – I don’t want to delete all associated blogs when I delete a LTI config – but the comments in this section of the code made me laugh.

// Now delete the blogs associated with this key. The WP function that lists all
// blog is depreciated and so we'll do a direct DB access (look the other way)

Also spotted this commented out in the LTI_WP_User class which might help with setting email values:

//$this->email = $lti_user_from_consumer->email;

Checking out lib/LTI_Tool_Provider suggests that the version included in the plugin had the required changes made to support the deprecation of the ‘context_’ parameters for LTI2.0
LTI 2.0 has since been deprecated as IMS made the decision to move to the revised security model on the LTI1.1 architecture. At first glance it looks to be nicely compatible with both specs. Some more reading is required.

Next steps I think are to use the test harness to get message formats for Blackboard Learn too.

Blackboard Learn
Course Delivery (3100.0.3-rel.51+917ccd3)
Community Engagement (3100.0.3-rel.51+917ccd3)
Content Management (3100.0.3-rel.51+917ccd3)

In-Built LTI functionality e.g. Building Blocks > LTI Tools

Set to provision Role, Name, Email (over SSL)

Message Parameters

context_id=1e2076abea6e45d9aae590a0a1b25ff6
 context_label=zp_ascott6_playground
 context_title=zp_ascott6_playground
 custom_caliper_federated_session_id=https://caliper-mapping.cloudbb.blackboard.com/v1/sites/ffa811f4-bc0f-48b4-802b-46eb07458b86/sessions/1277E4C4329E7BB76E88A7A5DB8FA5D4
 custom_caliper_profile_url=https://www-test.learn.ed.ac.uk/learn/api/v1/telemetry/caliper/profile/_934073_1
 custom_tc_profile_url=https://www-test.learn.ed.ac.uk/learn/api/v1/lti/profile
 ext_launch_id=dcadfbe3-15c4-4b0a-8548-c7b1fec46b0b
 ext_launch_presentation_css_url=https://www-test.learn.ed.ac.uk/common/shared.css,https://www-test.learn.ed.ac.uk/branding/themes/EdGEL-UniversityBlueTheme/theme.css
 ext_lms=bb-3100.0.3-rel.51+917ccd3
 launch_presentation_document_target=frame
 launch_presentation_locale=en-GB
 launch_presentation_return_url=https://www-test.learn.ed.ac.uk/webapps/blackboard/execute/blti/launchReturn?course_id=_9469_1&content_id=_934073_1&toGC=false&launch_time=1516736576465&launch_id=dcadfbe3-15c4-4b0a-8548-c7b1fec46b0b&link_id=_934073_1
 lis_person_contact_email_primary=anne-marie.scott@ed.ac.uk
 lis_person_name_family=Scott
 lis_person_name_full=Anne-Marie Scott
 lis_person_name_given=Anne-Marie
 lti_message_type=basic-lti-launch-request
 lti_version=LTI-1p0
 oauth_callback=about:blank
 oauth_consumer_key=jisc.ac.uk
 oauth_nonce=1597327861876306
 oauth_signature=MMzGHpM2pDYVBCjMj4cWo/Q7kDw=
 oauth_signature_method=HMAC-SHA1
 oauth_timestamp=1516736576
 oauth_version=1.0
 resource_link_id=_934073_1
 resource_link_title=LTI Test Harness
 roles=urn:lti:role:ims/lis/Instructor
 tool_consumer_info_product_family_code=Blackboard Learn
 tool_consumer_info_version=3100.0.3-rel.51+917ccd3
 tool_consumer_instance_contact_email=<Helpline email>
 tool_consumer_instance_guid=58fcdb515f794389baf2d493eac5b973
 tool_consumer_instance_name=University of Edinburgh
 user_id=<batchUID from IDM>

Basic LTI Building Block (from OSCELOT)

Message Parameters

context_id=zp_ascott6_playground
 context_label=zp_ascott6_playground
 context_title=zp_ascott6_playground
 context_type=CourseSection
 ext_lms=learn-3100.0.3-rel
 launch_presentation_document_target=window
 launch_presentation_locale=en_US
 lti_message_type=basic-lti-launch-request
 lti_version=LTI-1p0
 oauth_callback=about:blank
 oauth_consumer_key=jisc.ac.uk
 oauth_nonce=1605474819531318
 oauth_signature=h+DkPMAM8dkApLpAo7bA3tqLeWY=
 oauth_signature_method=HMAC-SHA1
 oauth_timestamp=1516744723
 oauth_version=1.0
 resource_link_id=zp_ascott6_playground
 resource_link_title=LTI Testing
 roles=Instructor
 tool_consumer_info_product_family_code=learn
 tool_consumer_info_version=3100.0.3-rel
 tool_consumer_instance_contact_email=<Learn support email>
 tool_consumer_instance_description=UoE live
 tool_consumer_instance_guid=jisc.ac.uk
 tool_consumer_instance_name=UoE-live
 tool_consumer_instance_url=<Learn test url>
 user_id=<Learn username>

Leave a Reply

Your email address will not be published. Required fields are marked *