Diff for /loncom/lti/ltiutils.pm between versions 1.1 and 1.4

version 1.1, 2017/12/07 15:36:25 version 1.4, 2018/01/04 12:09:42
Line 51  use LONCAPA qw(:DEFAULT :match); Line 51  use LONCAPA qw(:DEFAULT :match);
 #  #
 # When LON-CAPA is operating as a Provider, nonce checking   # When LON-CAPA is operating as a Provider, nonce checking 
 # occurs when a user in course context in another LMS (the   # occurs when a user in course context in another LMS (the 
 # Consumer launches an external tool to access a LON-CAPA URL:   # Consumer) launches an external tool to access a LON-CAPA URL: 
 # /adm/lti/ with LON-CAPA symb, map, or deep-link ID appended.  # /adm/lti/ with LON-CAPA symb, map, or deep-link ID appended.
 #  #
   
Line 290  sub verify_lis_item { Line 290  sub verify_lis_item {
                 if ($expected_sig eq $sigrec) {                  if ($expected_sig eq $sigrec) {
                     return 1;                      return 1;
                 } else {                  } else {
                     $errors->{16} = 1;                      $errors->{17} = 1;
                 }                  }
             } elsif ($context eq 'roster') {              } elsif ($context eq 'roster') {
                 my $uniqid = $digsymb.':::'.$cdom.'_'.$cnum;                  my $uniqid = $digsymb.':::'.$cdom.'_'.$cnum;
Line 298  sub verify_lis_item { Line 298  sub verify_lis_item {
                 if ($expected_sig eq $sigrec) {                  if ($expected_sig eq $sigrec) {
                     return 1;                      return 1;
                 } else {                  } else {
                     $errors->{17} = 1;                      $errors->{18} = 1;
                 }                  }
             }              }
         } else {          } else {
             $errors->{18} = 1;              $errors->{19} = 1;
         }          }
     } else {      } else {
         $errors->{19} = 1;          $errors->{20} = 1;
     }      }
     return;      return;
 }  }
Line 314  sub verify_lis_item { Line 314  sub verify_lis_item {
 # LON-CAPA as LTI Consumer  # LON-CAPA as LTI Consumer
 #  #
 # Sign a request used to launch an instance of an external  # Sign a request used to launch an instance of an external
 # too in a LON-CAPA course, using the key and secret supplied   # tool in a LON-CAPA course, using the key and secret supplied 
 # by the Tool Provider.  # by the Tool Provider.
 #   # 
   
 sub sign_params {  sub sign_params {
     my ($url,$key,$secret,$paramsref) = @_;      my ($url,$key,$secret,$sigmethod,$paramsref) = @_;
     return unless (ref($paramsref) eq 'HASH');      return unless (ref($paramsref) eq 'HASH');
       if ($sigmethod eq '') {
           $sigmethod = 'HMAC-SHA1';
       }
     my $nonce = Digest::SHA::sha1_hex(sprintf("%06x%06x",rand(0xfffff0),rand(0xfffff0)));      my $nonce = Digest::SHA::sha1_hex(sprintf("%06x%06x",rand(0xfffff0),rand(0xfffff0)));
     my $request = Net::OAuth->request("request token")->new(      my $request = Net::OAuth->request("request token")->new(
             consumer_key => $key,              consumer_key => $key,
             consumer_secret => $secret,              consumer_secret => $secret,
             request_url => $url,              request_url => $url,
             request_method => 'POST',              request_method => 'POST',
             signature_method => 'HMAC-SHA1',              signature_method => $sigmethod,
             timestamp => time,              timestamp => time,
             nonce => $nonce,              nonce => $nonce,
             callback => 'about:blank',              callback => 'about:blank',
Line 444  sub get_tool_lock { Line 447  sub get_tool_lock {
 #  #
   
 sub release_tool_lock {  sub release_tool_lock {
     my ($cdom,$cnum,$marker) = @_;      my ($cdom,$cnum,$marker,$name) = @_;
     #  remove lock      #  remove lock
     my @del_lock = ($name."\0".$marker."\0".'lock');      my @del_lock = ($name."\0".$marker."\0".'lock');
     my $dellockoutcome=&Apache::lonnet::del('exttools',\@del_lock,$cdom,$cnum);      my $dellockoutcome=&Apache::lonnet::del('exttools',\@del_lock,$cdom,$cnum);

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


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