File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
lib/WeBWorK/ContentGenerator Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -116,6 +116,19 @@ $LTI{v1p3}{AuthReqURL} = '';
116
116
# don't pile up in the database.
117
117
$LTI {v1p3 }{StateKeyLifetime } = 60; # in seconds
118
118
119
+ # When a LTI 1.3 launch request occurs the JWT in the request is decoded and the exp and iat in
120
+ # the token are validated. The expectation is that the iat and exp values are before (less
121
+ # than) the current time on the webwork2 server plus the JWTLeeway, and if they are greater than
122
+ # the current time plus the JWTLeeway then the JWT fails to validate. So the JWTLeeway is the
123
+ # maximum allowed time in seconds that the exp and iat values in the token are allowed to be
124
+ # after the current time. If the JWTs in these launch requests are failing to validate, then
125
+ # increase this value to allow for a larger difference between the exp and iat values in the JWT
126
+ # and the current time. This is usually caused by the clock on the LMS server being ahead of the
127
+ # clock on the webwork2 server. Generally, a small leeway may be needed, but if the clock on
128
+ # the LMS server is too far ahead of the clock on the webwork2 server, then steps should be
129
+ # taken to synchronize the clocks.
130
+ $LTI {v1p3 }{JWTLeeway } = 0; # in seconds
131
+
119
132
# ###############################################################################################
120
133
# LTI 1.3 LMS Roles Mapped to WeBWorK Roles
121
134
# ###############################################################################################
Original file line number Diff line number Diff line change @@ -161,6 +161,8 @@ sub launch ($c) {
161
161
$c -> stash-> {lti_jwt_claims }{' https://purl.imsglobal.org/spec/lti/claim/context' }{id }
162
162
]
163
163
];
164
+ } elsif ($c -> stash-> {LTIAuthenError }) {
165
+ debug($c -> stash-> {LTIAuthenError });
164
166
}
165
167
return $c -> render(
166
168
' ContentGenerator/LTI/content_item_selection_error' ,
@@ -365,6 +367,7 @@ sub extract_jwt_claims ($c) {
365
367
verify_aud => $ce -> {LTI }{v1p3 }{ClientID },
366
368
verify_iat => 1,
367
369
verify_exp => 1,
370
+ leeway => $ce -> {LTI }{v1p3 }{JWTLeeway } // 0,
368
371
# This just checks that this claim is present.
369
372
verify_sub => sub ($value ) { return $value =~ / \S / }
370
373
);
You can’t perform that action at this time.
0 commit comments