From 96d11239725c2acf7766c74b7594437076903d95 Mon Sep 17 00:00:00 2001 From: Nikolas Nyby Date: Thu, 16 Jan 2025 13:08:58 -0500 Subject: [PATCH] Introduce django-lti - INFRA-2583 For LTI 1.3 compatibility. An "LTI registration" object can be created in the lti_tool section of Django admin. This enables the view to be linked to from Canvas. Here are some of the configuration options which must be filled in when creating an LTI registration within the Django admin: * Client ID: The ID of the Developer Key created in Canvas * Auth URL: `https:///api/lti/authorize_redirect` * Access token URL: `https:///login/oauth2/auth` * Keyset URL: `https:///api/lti/security/jwks` I am not 100% certain on the accuracy of all of these values yet. I am still investigating the integration steps. It seems many different integration methods are possible. --- lti_auth/urls.py | 6 ++++++ mediathread/settings_shared.py | 2 ++ requirements.txt | 6 ++++++ 3 files changed, 14 insertions(+) diff --git a/lti_auth/urls.py b/lti_auth/urls.py index 431d465395..4b311c9b26 100644 --- a/lti_auth/urls.py +++ b/lti_auth/urls.py @@ -2,6 +2,7 @@ from lti_auth.views import LTIConfigView, LTILandingPage, LTIRoutingView, \ LTICourseEnableView +from lti_tool.views import jwks, OIDCLoginInitView urlpatterns = [ @@ -10,4 +11,9 @@ path('landing//', LTILandingPage.as_view(), {}, 'lti-landing-page'), path('', LTIRoutingView.as_view(), {}, 'lti-login'), + + # django-lti + path('.well-known/jwks.json', jwks, name='jwks'), + path('init//', + OIDCLoginInitView.as_view(), name='oidc_init'), ] diff --git a/mediathread/settings_shared.py b/mediathread/settings_shared.py index 0d27f68c4c..9d0a9be1d4 100644 --- a/mediathread/settings_shared.py +++ b/mediathread/settings_shared.py @@ -67,6 +67,7 @@ 'corsheaders.middleware.CorsMiddleware', 'mediathread.main.middleware.MethCourseManagerMiddleware', 'django_user_agents.middleware.UserAgentMiddleware', + 'lti_tool.middleware.LtiLaunchMiddleware', ] DEFAULT_AUTO_FIELD = 'django.db.models.AutoField' @@ -95,6 +96,7 @@ 'corsheaders', 'reversion', 'lti_auth', + 'lti_tool', 'bootstrap3', 'bootstrap4', 'django_extensions', diff --git a/requirements.txt b/requirements.txt index c4440a8a83..69eaed47f7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -83,6 +83,12 @@ oauth==1.0.1 oauth2==1.9.0.post1 oauthlib==3.2.2 pylti==0.7.0 + +pyjwt==2.10.1 # pylti1p3 +jwcrypto==1.5.6 # pylti1p3 +PyLTI1p3==2.0.0 # django-lti +django-lti==0.7.0 + nameparser==1.1.0 django-bootstrap3==24.3 django-bootstrap4==24.4