Diff for /loncom/lti/ltiroster.pm between versions 1.3 and 1.4

version 1.3, 2017/12/18 23:59:31 version 1.4, 2018/08/14 21:42:36
Line 32  use strict; Line 32  use strict;
 use Apache::Constants qw(:common :http);  use Apache::Constants qw(:common :http);
 use Encode;  use Encode;
 use Digest::SHA;  use Digest::SHA;
   use URI::Escape;
 use Apache::lonnet;  use Apache::lonnet;
 use Apache::loncommon;  use Apache::loncommon;
 use Apache::lonacc;  use Apache::lonacc;
Line 41  use LONCAPA::ltiutils; Line 42  use LONCAPA::ltiutils;
 sub handler {  sub handler {
     my $r = shift;      my $r = shift;
     my %errors;      my %errors;
       my $params = {};
       my ($oauthtype,$authheader);
   #
   # Retrieve content type from headers
   #
       my $content_type = $r->headers_in->get('Content-Type');
       if ($content_type eq 'application/xml') {
           $oauthtype = 'consumer';
   #
   # Retrieve OAuth data sent by LTI Provider from Authorization header
   #
           $authheader = $r->headers_in->get('Authorization');
           my ($authtype,$valuestr) = ($authheader =~ /^(OAuth)\s+(.+)$/i);
           if (lc($authtype) eq 'oauth') {
               foreach my $pair (split(/\s*,\s*/,$valuestr)) {
                   my ($key,$value) = split(/=/,$pair);
                   $value =~ s /(^"|"$)//g;
                   $params->{$key} = URI::Escape::uri_unescape($value);
               }
           }
       } else {
           $oauthtype = 'request token';
 #  #
 # Retrieve data POSTed by LTI Provider  # Retrieve data POSTed by LTI Provider
 #  #
     &Apache::lonacc::get_posted_cgi($r);          &Apache::lonacc::get_posted_cgi($r);
     my $params = {};          foreach my $key (sort(keys(%env))) {
     foreach my $key (sort(keys(%env))) {              if ($key =~ /^form\.(.+)$/) {
         if ($key =~ /^form\.(.+)$/) {                  $params->{$1} = $env{$key};
             $params->{$1} = $env{$key};              }
         }          }
     }      }
   
Line 124  sub handler { Line 147  sub handler {
     }      }
     unless (LONCAPA::ltiutils::verify_request($params,$protocol,$r->hostname,$r->uri,      unless (LONCAPA::ltiutils::verify_request($params,$protocol,$r->hostname,$r->uri,
                                               $env{'request.method'},$consumer_secret,                                                $env{'request.method'},$consumer_secret,
                                               \%errors)) {                                                $params,$authheader,\%errors)) {
         &invalid_request($r,\%errors);          &invalid_request($r,\%errors);
         return OK;          return OK;
     }      }

Removed from v.1.3  
changed lines
  Added in v.1.4


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>