LTI 1.3 Provider Implementation for general edx usage
Advantage Services Implemented:
- Assignment and Gradaes Service (AGS) for grade passback
Add optional version tag as necessary.
pip install git+https://github.com/iblai/ibl-edx-lti-1p3-provider-app.git
- Ensure
settings.FEATURES['ENABLE_LTI_1P3_PROVIDER] = True
is set inlms/envs/common.py
- Add a condition to add the lti 1.3 provider authentication backend:
if FEATURES.get("ENABLE_LTI_1P3_PROVIDER"):
AUTHENTICATION_BACKENDS.append("lti_1p3_provider.auth.Lti1p3AuthenticationBackend")
These are both implemented in the included tutor_plugins/enable_lti_1p3_provider.py
tutor plugin.
LTI_AGGREGATE_SCORE_PASSBACK_DELAY
: Number of seconds to wait to perform grade passback on composite modules (subsections and units). This helps batch requests. default: 15 minutes- NOTE: This setting is shared for the LTI 1.1 Provider so would affect both 1.1 and 1.3
LTI_1P3_PROVIDER_ACCESS_LENGTH_SEC
: Number of seconds from launch that the session should be valid for the given piece of content. Default isNone
which allows access as long as the user has a valid edx session.
You technically only need to do this once. It's going to be the Private/Public key for one or multiple tools to use.
NOTE: Never share the private key under any circumstances
To generate a public/private key pair you can use the following commands:
# Private Key
openssl genrsa -out private_key.pem 2048
# Public Key
openssl rsa -in private_key.pem -outform PEM -pubout -out public_key.pem
Once generated, you can copy the contents into their respective fields in the next steps.
- Go to the django admin
- Select
Lti 1.3 tool keys
under thePYLTI 1.3 TOOL CONFIG
heading - Select
Add LTI 1.3 TOOL KEY
- Give it a name
- Add a
Private Key
and its correspondgingPublic Key
(see previous section)- These should be strings in the PEM format and start like:
-----BEGIN RSA PRIVATE KEY-----
and-----BEGIN PUBLIC KEY-----
- These should be strings in the PEM format and start like:
- Click
Save
To setup a Tool, complete the following steps. You will need to get several entries from the Platform
(Consumer):
- Go to the django admin
- Select
Lti 1.3 tools
under thePYLTI 1.3 TOOL CONFIG
heading - Select
Add LTI 1.3 TOOL
Title
: Give the tool a nameIs active
: Make sure this is checkedIssuer
: Get from thePlatform
Client id
: Get fromPlatform
Use by default
: leave this uncheckedAuth login url
: Get fromPlatform
(OIDC Authorication Endpoint)Auth token url
: Get fromPlatform
(OIDC Token Endpoint)Auth audience
: Should be able to leave this blankKey set url
: Get fromPlatform
if availableKey set
: If noKey set url
is available, paste the JWKS information here- This will be a
json
string like the following:
{ "e": "AQAB", "kid": "_MrLpE3BZv9Ecxpo5J93WTm732I0ktE64nv6c8ywywI", "kty": "RSA", "n": "uDmuwK_POsBicZy7lnFAMo_9QNu-W_yqTuzV8g5p-NM1xzD4Gj1dJel2IKi-eh9Rwyc8dPrJWfA0BaHx0ggA9hMXLVjql9UtRYm3wf7uJ8JfDfePYOHGHymLalRVCT_wXP7EO0l1BarNRqG-c9OVG6rELryosQxCgt5p4ipE_RU5OPOYK5eZKnOUAHkcbUO1Xtqlm8FghWqjrDEqS6wbteCBqUuFYBjReG47L-UJp_THt0hI-iYnnDmuIVZdkVpmNYHW3RbsZIj1Oc62msRzknLHP-UJlN6125H3hwvBzcl2xLXMi8eQ5Nd1NKP0Zj-asEJgiCU5cMp0U6F63wZ-oQ", "alg": "RS256", "use": "sig" }
- This will be a
Tool key
: Select one of theLti Tool Key
's you generated earlier- This is the Private/Public key the Tool will use to sign its messages and that the
Platform
will use to verify them
- This is the Private/Public key the Tool will use to sign its messages and that the
Deployment ids
: Get fromPlatform
- This should be a list of strings:
["1", "deployment 2"]
, etc
- This should be a list of strings:
- Select
Save
Provide the following information to the Platform
for their side of the integration:
- Redirect Uri:
https://<lms_domain.com>/lti/1p3/launch/
- This is where the consumer will post its
id_token
to
- This is where the consumer will post its
- Tool Launch Endpoint:
https://<lms_domain.com>/lti/1p3/launch/<course_key>/<usage_key>
- This is also known as the
target_link_uri
- the final place the user will be redirected to (the content to show the user)
- This is also known as the
- Login Initiations Endpoint:
https://<lms_domain.com>/lti/1p3/login/
- JWKS Endpoint (Tool Keyset):
https://<lms_domain.com>/lti/1p3/pub/jwks/
- Deep Linking Endpoint: Not yet implemented
To use the LTI Assignment and Grades service (Grade passback), the Platform
will need to allow the following scopes for the Tool OAuth2 client:
https://purl.imsglobal.org/spec/lti-ags/scope/lineitem
https://purl.imsglobal.org/spec/lti-ags/scope/score
By default, a consumer could link to any content on the platform by changing the target_link_uri
. To restrict this, a LaunchGate
can be added to the consumer. This will restrict the consumer to launching content that is either:
- In the
allowed_keys
list - In the
allowed_orgs
list
This can be added in the Django Admin under lti_1p3_providers
-> Launch gates
.
Access to content is controlled by three components:
- The user must be logged in
- They must have the
target_link_uri
path in their session - They corresponding expiration is
None
or not expired if set
The length of access to the content is controlled by the LTI_1P3_PROVIDER_ACCESS_LENGTH_SEC variable. The default is None
(unset), which allows access as long as the user is logged in. If set to an integer, access is allowed for the specified number of seconds since launch..
The course and content must be published and available for a Consumer
to be able to use it. Otherwise it will return a 404.
- In an openedx dev environment, run
pytest ../<path_to_repo>/src/lti_1p3_provider/tests --disable-warnings --no-migrations