--- loncom/lti/ltiauth.pm 2022/02/08 15:08:53 1.33 +++ loncom/lti/ltiauth.pm 2022/03/29 19:37:25 1.35 @@ -1,7 +1,7 @@ # The LearningOnline Network # Basic LTI Authentication Module # -# $Id: ltiauth.pm,v 1.33 2022/02/08 15:08:53 raeburn Exp $ +# $Id: ltiauth.pm,v 1.35 2022/03/29 19:37:25 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -30,6 +30,7 @@ package Apache::ltiauth; use strict; use LONCAPA qw(:DEFAULT :match); +use Encode; use Apache::Constants qw(:common :http); use Apache::lonlocal; use Apache::lonnet; @@ -63,7 +64,7 @@ sub handler { my $params = {}; foreach my $key (sort(keys(%env))) { if ($key =~ /^form\.(.+)$/) { - $params->{$1} = $env{$key}; + $params->{$1} = &Encode::decode('UTF-8',$env{$key}); } } # @@ -143,9 +144,9 @@ sub handler { # my ($itemid,$ltitype,%crslti,%lti_in_use); - $itemid = &get_lti_itemid($requri,$hostname,$params,$cdom,$cnum,'deeplink'); + $itemid = &get_lti_itemid($requri,$hostname,$params,$cdom,$cnum,'linkprot'); if ($itemid) { - %crslti = &Apache::lonnet::get_course_lti($cnum,$cdom,'provider'); + %crslti = &Apache::lonnet::get_course_lti($cnum,$cdom); } if (($itemid) && (ref($crslti{$itemid}) eq 'HASH')) { $ltitype = 'c'; @@ -157,10 +158,10 @@ sub handler { return OK; } } else { - $itemid = &get_lti_itemid($requri,$hostname,$params,$cdom,'','deeplink'); + $itemid = &get_lti_itemid($requri,$hostname,$params,$cdom,'','linkprot'); my %lti; if ($itemid) { - %lti = &Apache::lonnet::get_domain_lti($cdom,'provider'); + %lti = &Apache::lonnet::get_domain_lti($cdom,'linkprot'); } if (($itemid) && (ref($lti{$itemid}) eq 'HASH')) { $ltitype = 'd'; @@ -185,7 +186,7 @@ sub handler { } if ($ltiauth) { my $possuname; - my $mapuser = $crslti{$itemid}{'mapuser'}; + my $mapuser = $lti_in_use{'mapuser'}; if ($mapuser eq 'sourcedid') { if ($params->{'lis_person_sourcedid'} =~ /^$match_username$/) { $possuname = $params->{'lis_person_sourcedid'}; @@ -1054,9 +1055,9 @@ sub linkprot_session { my ($r,$uname,$cnum,$cdom,$uhome,$itemid,$ltitype,$dest,$lonhost) = @_; $r->user($uname); if ($ltitype eq 'c') { - &Apache::lonnet::logthis("Link Protector: $itemid (c) authorized student: $uname:$cdom, course: $cdom\_$cnum"); + &Apache::lonnet::logthis("Course Link Protector ($itemid) authorized student: $uname:$cdom, course: $cdom\_$cnum"); } elsif ($ltitype eq 'd') { - &Apache::lonnet::logthis("Link Protector: $itemid (d) authorized student: $uname:$cdom, course: $cdom\_$cnum"); + &Apache::lonnet::logthis("Domain LTI for link protection ($itemid) authorized student: $uname:$cdom, course: $cdom\_$cnum"); } my ($is_balancer,$otherserver,$hosthere) = &check_balancer($r,$uname,$cdom); if (($is_balancer) && (!$hosthere)) {