Add an LTI 1.3 debug log in the case that the JWT fails to decode on a launch request. (hotfix version) #2787
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In this case the LTIAuthenError stash value is set, but that error is never shown anywhere because the course ID was not determined and the authen verify method is never called. So this information goes to the abyss and the debug log abrubtly terminates (see https://forums.openwebwork.org/mod/forum/discuss.php?d=8749 for what this debug log looks like). So this pull request always debug logs it in this case. There is not enough information to even determine if LTI debugging is enabled for the course (which the request failed to determine), so it has to be the more general debug logging facility. This may help in resolving the issues that are occuring with the cases such as those in the above mentioned forum post and https://forums.openwebwork.org/mod/forum/discuss.php?d=8738#p22228.
Edit:
This also now adds a JWTLeeway for LTI 1.3 JWT validation. This is the maximum number of seconds that the exp and iat values in the JWT sent with a launch request are allowed to be in the future relative to the current time on the webwork2 server. The Crypt::JWT module by default uses a value of 0 for this, meaning that the iat and exp values in the token must be before the current time on the webwork2 server.
This may be why many are experiencing issues with JWT tokens failing to validate, and is due to the clock on the LMS server being ahead of the clock on the webwork2 server. Generally such issues can be resolved by synchronizing clocks, but in some cases a small leeway may be needed.