--- loncom/interface/domainprefs.pm 2017/12/06 23:41:19 1.321
+++ loncom/interface/domainprefs.pm 2017/12/30 14:03:53 1.323
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.321 2017/12/06 23:41:19 raeburn Exp $
+# $Id: domainprefs.pm,v 1.323 2017/12/30 14:03:53 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -4112,16 +4112,22 @@ sub print_ltitools {
for (my $i=0; $i<@items; $i++) {
$css_class = $itemcount%2?' class="LC_odd_row"':'';
my $item = $ordered{$items[$i]};
- my ($title,$key,$secret,$url,$imgsrc);
+ my ($title,$key,$secret,$url,$lifetime,$imgsrc,%sigsel);
if (ref($settings->{$item}) eq 'HASH') {
$title = $settings->{$item}->{'title'};
$url = $settings->{$item}->{'url'};
$key = $settings->{$item}->{'key'};
$secret = $settings->{$item}->{'secret'};
+ $lifetime = $settings->{$item}->{'lifetime'};
my $image = $settings->{$item}->{'image'};
if ($image ne '') {
$imgsrc = '';
}
+ if ($settings->{$item}->{'sigmethod'} eq 'HMAC-256') {
+ $sigsel{'HMAC-256'} = ' selected="selected"';
+ } else {
+ $sigsel{'HMAC-SHA1'} = ' selected="selected"';
+ }
}
my $chgstr = ' onchange="javascript:reorderLTITools(this.form,'."'ltitools_".$item."'".');"';
$datatable .= '
'
@@ -4139,20 +4145,27 @@ sub print_ltitools {
&mt('Delete?').' | '.
''.
' | '."\n".
''.
''.
@@ -4382,7 +4400,7 @@ sub print_ltitools {
);
my %defaulttimes = (
'passback' => '7',
- 'roster' => '300',
+ 'roster' => '300',
);
foreach my $extra ('passback','roster') {
my $onclick = ' onclick="toggleLTITools(this.form,'."'$extra','add'".');"';
@@ -4451,8 +4469,10 @@ sub ltitools_names {
'title' => 'Title',
'version' => 'Version',
'msgtype' => 'Message Type',
+ 'sigmethod' => 'Signature Method',
'url' => 'URL',
'key' => 'Key',
+ 'lifetime' => 'Nonce lifetime (s)',
'secret' => 'Secret',
'icon' => 'Icon',
'user' => 'Username:domain',
@@ -4569,7 +4589,7 @@ sub print_lti {
''.$lt{'version'}.': '."\n".
(' 'x2).
- ''.$lt{'lifetime'}.': '."\n".
+ ''.$lt{'lifetime'}.': '."\n".
'
'.
''.$lt{'key'}.': '."\n".
(' 'x2).
@@ -4587,7 +4607,7 @@ sub lti_names {
'version' => 'LTI Version',
'url' => 'URL',
'key' => 'Key',
- 'lifetime' => 'Nonce lifetime (seconds)',
+ 'lifetime' => 'Nonce lifetime (s)',
'consumer' => 'LTI Consumer',
'secret' => 'Secret',
'email' => 'Email address',
@@ -10644,8 +10664,11 @@ sub modify_ltitools {
$allpos[$position] = $newid;
}
$changes{$newid} = 1;
- foreach my $item ('title','url','key','secret') {
+ foreach my $item ('title','url','key','secret','lifetime') {
$env{'form.ltitools_add_'.$item} =~ s/(`)/'/g;
+ if ($item eq 'lifetime') {
+ $env{'form.ltitools_add_'.$item} =~ s/[^\d.]//g;
+ }
if ($env{'form.ltitools_add_'.$item}) {
if (($item eq 'key') || ($item eq 'secret')) {
$encconfig{$newid}{$item} = $env{'form.ltitools_add_'.$item};
@@ -10660,6 +10683,11 @@ sub modify_ltitools {
if ($env{'form.ltitools_add_msgtype'} eq 'basic-lti-launch-request') {
$confhash{$newid}{'msgtype'} = $env{'form.ltitools_add_msgtype'};
}
+ if ($env{'form.ltitools_add_sigmethod'} eq 'HMAC-SHA256') {
+ $confhash{$newid}{'sigmethod'} = $env{'form.ltitools_add_sigmethod'};
+ } else {
+ $confhash{$newid}{'sigmethod'} = 'HMAC-SHA1';
+ }
foreach my $item ('width','height','linktext','explanation') {
$env{'form.ltitools_add_'.$item} =~ s/^\s+//;
$env{'form.ltitools_add_'.$item} =~ s/\s+$//;
@@ -10768,7 +10796,7 @@ sub modify_ltitools {
} else {
my $newpos = $env{'form.ltitools_'.$itemid};
$newpos =~ s/\D+//g;
- foreach my $item ('title','url') {
+ foreach my $item ('title','url','lifetime') {
$confhash{$itemid}{$item} = $env{'form.ltitools_'.$item.'_'.$i};
if ($domconfig{$action}{$itemid}{$item} ne $confhash{$itemid}{$item}) {
$changes{$itemid} = 1;
@@ -10786,6 +10814,18 @@ sub modify_ltitools {
if ($env{'form.ltitools_msgtype_'.$i} eq 'basic-lti-launch-request') {
$confhash{$itemid}{'msgtype'} = $env{'form.ltitools_msgtype_'.$i};
}
+ if ($env{'form.ltitools_sigmethod_'.$i} eq 'HMAC-SHA256') {
+ $confhash{$itemid}{'sigmethod'} = $env{'form.ltitools_sigmethod_'.$i};
+ } else {
+ $confhash{$itemid}{'sigmethod'} = 'HMAC-SHA1';
+ }
+ if ($domconfig{$action}{$itemid}{'sigmethod'} eq '') {
+ if ($confhash{$itemid}{'sigmethod'} ne 'HMAC-SHA1') {
+ $changes{$itemid} = 1;
+ }
+ } elsif ($domconfig{$action}{$itemid}{'sigmethod'} ne $confhash{$itemid}{'sigmethod'}) {
+ $changes{$itemid} = 1;
+ }
foreach my $size ('width','height') {
$env{'form.ltitools_'.$size.'_'.$i} =~ s/^\s+//;
$env{'form.ltitools_'.$size.'_'.$i} =~ s/\s+$//;
@@ -11032,7 +11072,7 @@ sub modify_ltitools {
$resulttext .= '';
my $position = $pos + 1;
$resulttext .= '- '.&mt('Order: [_1]',$position).'
';
- foreach my $item ('version','msgtype','url') {
+ foreach my $item ('version','msgtype','sigmethod','url','lifetime') {
if ($confhash{$itemid}{$item} ne '') {
$resulttext .= '- '.$lt{$item}.': '.$confhash{$itemid}{$item}.'
';
}
|