Skip to content

Commit

Permalink
fix(Deep Linking): Fixing Deep Linking JWT. Iat and Exp are now gener…
Browse files Browse the repository at this point in the history
…ated by library.
  • Loading branch information
Cvmcosta committed Jan 27, 2021
1 parent 6221a94 commit a00b3c2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
3 changes: 1 addition & 2 deletions dist/Provider/Services/DeepLinking.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 1 addition & 3 deletions src/Provider/Services/DeepLinking.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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
}
}
Expand Down

0 comments on commit a00b3c2

Please sign in to comment.