This commit is contained in:
Markos Gogoulos
2025-12-29 19:06:58 +02:00
parent d0ebe19c2a
commit 30491bf420
2 changed files with 14 additions and 6 deletions

View File

@@ -229,8 +229,12 @@ class DjangoToolConfig(ToolConfAbstract):
# Set tool's private key for signing (e.g., Deep Linking responses)
key_obj = LTIToolKeys.get_or_create_keys()
# Pass the full JWK dict (includes kid) - PyLTI1p3 will handle conversion
registration.set_tool_private_key(key_obj.private_key_jwk)
jwk_obj = jwk.JWK(**key_obj.private_key_jwk)
pem_bytes = jwk_obj.export_to_pem(private_key=True, password=None)
# Set both the key and kid directly on Registration internal attributes
registration._tool_private_key = pem_bytes.decode('utf-8')
registration._tool_private_key_kid = key_obj.private_key_jwk['kid']
return registration
@@ -255,8 +259,12 @@ class DjangoToolConfig(ToolConfAbstract):
# Set tool's private key for signing (e.g., Deep Linking responses)
key_obj = LTIToolKeys.get_or_create_keys()
# Pass the full JWK dict (includes kid) - PyLTI1p3 will handle conversion
registration.set_tool_private_key(key_obj.private_key_jwk)
jwk_obj = jwk.JWK(**key_obj.private_key_jwk)
pem_bytes = jwk_obj.export_to_pem(private_key=True, password=None)
# Set both the key and kid directly on Registration internal attributes
registration._tool_private_key = pem_bytes.decode('utf-8')
registration._tool_private_key_kid = key_obj.private_key_jwk['kid']
return registration

View File

@@ -144,8 +144,8 @@ class SelectMediaView(View):
# Get deep linking settings from original launch data
deep_linking_settings = message_launch_data.get('https://purl.imsglobal.org/spec/lti-dl/claim/deep_linking_settings', {})
# Create DeepLink instance directly
deep_link = DeepLink(registration, deployment_id, deep_linking_settings)
# Create DeepLink instance with tool_config for key retrieval
deep_link = DeepLink(registration, deployment_id, deep_linking_settings, tool_config=tool_config)
# Convert content_items to DeepLinkResource objects
resources = []