From a00b3c268f49712391aa7dded3ae4bdc2ea8d51e Mon Sep 17 00:00:00 2001 From: cvmcosta Date: Wed, 27 Jan 2021 18:59:31 -0300 Subject: [PATCH] fix(Deep Linking): Fixing Deep Linking JWT. Iat and Exp are now generated by library. --- dist/Provider/Services/DeepLinking.js | 3 +-- src/Provider/Services/DeepLinking.js | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/dist/Provider/Services/DeepLinking.js b/dist/Provider/Services/DeepLinking.js index 876ae98..6437960 100644 --- a/dist/Provider/Services/DeepLinking.js +++ b/dist/Provider/Services/DeepLinking.js @@ -103,8 +103,6 @@ class DeepLinking { const jwtBody = { iss: await platform.platformClientId(), aud: idtoken.iss, - iat: Date.now() / 1000, - exp: Date.now() / 1000 + 60, nonce: encodeURIComponent([...Array(25)].map(_ => (Math.random() * 36 | 0).toString(36)).join``), 'https://purl.imsglobal.org/spec/lti/claim/deployment_id': idtoken.deploymentId, 'https://purl.imsglobal.org/spec/lti/claim/message_type': 'LtiDeepLinkingResponse', @@ -140,6 +138,7 @@ class DeepLinking { jwtBody['https://purl.imsglobal.org/spec/lti-dl/claim/content_items'] = selectedContentItems; const message = jwt.sign(jwtBody, await platform.platformPrivateKey(), { algorithm: 'RS256', + expiresIn: 60, keyid: await platform.platformKid() }); return message; diff --git a/src/Provider/Services/DeepLinking.js b/src/Provider/Services/DeepLinking.js index 11feb58..89f6cd8 100644 --- a/src/Provider/Services/DeepLinking.js +++ b/src/Provider/Services/DeepLinking.js @@ -72,8 +72,6 @@ class DeepLinking { const jwtBody = { iss: await platform.platformClientId(), aud: idtoken.iss, - iat: Date.now() / 1000, - exp: Date.now() / 1000 + 60, nonce: encodeURIComponent([...Array(25)].map(_ => (Math.random() * 36 | 0).toString(36)).join``), 'https://purl.imsglobal.org/spec/lti/claim/deployment_id': idtoken.deploymentId, 'https://purl.imsglobal.org/spec/lti/claim/message_type': 'LtiDeepLinkingResponse', @@ -112,7 +110,7 @@ class DeepLinking { provDeepLinkingDebug(selectedContentItems) jwtBody['https://purl.imsglobal.org/spec/lti-dl/claim/content_items'] = selectedContentItems - const message = jwt.sign(jwtBody, await platform.platformPrivateKey(), { algorithm: 'RS256', keyid: await platform.platformKid() }) + const message = jwt.sign(jwtBody, await platform.platformPrivateKey(), { algorithm: 'RS256', expiresIn: 60, keyid: await platform.platformKid() }) return message } }