Skip to content

Commit ce77ae5

Browse files
authored
Merge pull request #2352 from drgrice1/lti-1.3-audience-hotfix
Separate the LTI 1.3 audience and URL and correct iss claim (hotfix of #2342)
2 parents 83aadfb + ed8f2ea commit ce77ae5

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

conf/authen_LTI_1_3.conf.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ $LTI{v1p3}{ClientID} = '';
100100
$LTI{v1p3}{DeploymentID} = '';
101101
$LTI{v1p3}{PublicKeysetURL} = '';
102102
$LTI{v1p3}{AccessTokenURL} = '';
103+
$LTI{v1p3}{AccessTokenAUD} = '';
103104
$LTI{v1p3}{AuthReqURL} = '';
104105

105106
# In the process of LTI 1.3 authentication a request is sent to the LMS in response to its

lib/WeBWorK/Authen/LTIAdvantage.pm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,9 @@ sub get_credentials ($self) {
205205
}
206206

207207
# Get the target_link_uri from the claims.
208-
$c->stash->{LTILauncRedirect} = $claims->{'https://purl.imsglobal.org/spec/lti/claim/target_link_uri'};
208+
$c->stash->{LTILaunchRedirect} = $claims->{'https://purl.imsglobal.org/spec/lti/claim/target_link_uri'};
209209

210-
unless (defined $c->stash->{LTILauncRedirect}) {
210+
unless (defined $c->stash->{LTILaunchRedirect}) {
211211
$self->{error} = $c->maketext(
212212
'There was an error during the login process. Please speak to your instructor or system administrator.');
213213
warn 'LTI is not properly configured (failed to obtain target_link_uri). '
@@ -218,7 +218,7 @@ sub get_credentials ($self) {
218218

219219
# Get the courseID from the target_link_uri and verify that it is the same as the one that was in the state.
220220
my $location = $c->location;
221-
my $target = $c->url_for($c->stash->{LTILauncRedirect})->path;
221+
my $target = $c->url_for($c->stash->{LTILaunchRedirect})->path;
222222
my $courseID;
223223
$courseID = $1 if $target =~ m|$location/([^/]*)|;
224224

lib/WeBWorK/Authen/LTIAdvantage/SubmitGrade.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ async sub get_access_token ($self) {
137137
my $jwt = eval {
138138
encode_jwt(
139139
payload => {
140-
aud => $ce->{LTI}{v1p3}{AccessTokenURL},
141-
iss => $c->url_for('root')->to_abs->to_string,
140+
aud => $ce->{LTI}{v1p3}{AccessTokenAUD},
141+
iss => $ce->{LTI}{v1p3}{ClientID},
142142
sub => $ce->{LTI}{v1p3}{ClientID},
143143
jti => $private_key->{kid}
144144
},

lib/WeBWorK/ContentGenerator/LTIAdvantage.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ sub login ($c) {
2424
}
2525

2626
sub launch ($c) {
27-
return $c->redirect_to($c->systemLink($c->url_for($c->stash->{LTILauncRedirect})));
27+
return $c->redirect_to($c->systemLink($c->url_for($c->stash->{LTILaunchRedirect})));
2828
}
2929

3030
sub keys ($c) {

0 commit comments

Comments
 (0)