version 1.1510, 2023/05/22 21:10:55
|
version 1.1511, 2023/06/02 01:20:29
|
Line 416 sub remote_devalidate_cache {
|
Line 416 sub remote_devalidate_cache {
|
} |
} |
|
|
sub sign_lti { |
sub sign_lti { |
my ($cdom,$cnum,$crstool,$url,$idx,$keynum,$post,$paramsref,$inforef) = @_; |
my ($cdom,$cnum,$crsdef,$type,$context,$url,$ltinum,$keynum,$paramsref,$inforef) = @_; |
my $chome; |
my $chome; |
if (&domain($cdom) ne '') { |
if (&domain($cdom) ne '') { |
if ($crstool) { |
if ($crsdef) { |
$chome = &homeserver($cnum,$cdom); |
$chome = &homeserver($cnum,$cdom); |
} else { |
} else { |
$chome = &domain($cdom,'primary'); |
$chome = &domain($cdom,'primary'); |
Line 432 sub sign_lti {
|
Line 432 sub sign_lti {
|
if (grep { $_ eq $chome } ¤t_machine_ids()) { |
if (grep { $_ eq $chome } ¤t_machine_ids()) { |
# domain information is hosted on this machine |
# domain information is hosted on this machine |
$rep = |
$rep = |
&LONCAPA::Lond::sign_params($cdom,$cnum,$crstool,$url, |
&LONCAPA::Lond::sign_lti_payload($cdom,$cnum,$crsdef,$type, |
$idx,$keynum,$post, |
$context,$url,$ltinum,$keynum, |
$perlvar{'lonVersion'}, |
$perlvar{'lonVersion'}, |
$paramsref,$inforef); |
$paramsref,$inforef); |
if ($rep ne '') { |
if (ref($rep) eq 'HASH') { |
return ('ok',$rep); |
return ('ok',$rep); |
} |
} |
} else { |
} else { |
Line 448 sub sign_lti {
|
Line 448 sub sign_lti {
|
if (ref($inforef) eq 'HASH') { |
if (ref($inforef) eq 'HASH') { |
$info = &freeze_escape($inforef); |
$info = &freeze_escape($inforef); |
} |
} |
$rep=&reply("encrypt:signlti:$cdom:$cnum:$crstool:$escurl:$idx:$keynum:$post:$params:$info",$chome); |
$rep=&reply("encrypt:signlti:$cdom:$cnum:$crsdef:$type:$context:$escurl:$ltinum:$keynum:$params:$info",$chome); |
} |
} |
if (($rep eq '') || ($rep =~ /^con_lost|error|no_such_host|unknown_cmd/i)) { |
if (($rep eq '') || ($rep =~ /^con_lost|error|no_such_host|unknown_cmd/i)) { |
return (); |
return (); |
|
} elsif (($inforef->{'respfmt'} eq 'to_post_body') || |
|
($inforef->{'respfmt'} eq 'to_authorization_header')) { |
|
return ('ok',$rep); |
} else { |
} else { |
my %returnhash; |
my %returnhash; |
foreach my $item (split(/\&/,$rep)) { |
foreach my $item (split(/\&/,$rep)) { |
Line 12550 sub get_domain_lti {
|
Line 12553 sub get_domain_lti {
|
} else { |
} else { |
return %lti; |
return %lti; |
} |
} |
|
|
if ($context eq 'linkprot') { |
if ($context eq 'linkprot') { |
$cachename = $context; |
$cachename = $context; |
} else { |
} else { |
$cachename = $name; |
$cachename = $name; |
} |
} |
|
|
my ($result,$cached)=&is_cached_new($cachename,$cdom); |
my ($result,$cached)=&is_cached_new($cachename,$cdom); |
if (defined($cached)) { |
if (defined($cached)) { |
if (ref($result) eq 'HASH') { |
if (ref($result) eq 'HASH') { |
Line 12572 sub get_domain_lti {
|
Line 12573 sub get_domain_lti {
|
} else { |
} else { |
%lti = %{$domconfig{$name}}; |
%lti = %{$domconfig{$name}}; |
} |
} |
if (($context eq 'consumer') && (keys(%lti))) { |
|
my %encdomconfig = &get_dom('encconfig',[$name],$cdom,undef,1); |
|
if (ref($encdomconfig{$name}) eq 'HASH') { |
|
foreach my $id (keys(%lti)) { |
|
if (ref($encdomconfig{$name}{$id}) eq 'HASH') { |
|
foreach my $item ('key','secret') { |
|
$lti{$id}{$item} = $encdomconfig{$name}{$id}{$item}; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
} |
my $cachetime = 24*60*60; |
my $cachetime = 24*60*60; |
&do_cache_new($cachename,$cdom,\%lti,$cachetime); |
&do_cache_new($cachename,$cdom,\%lti,$cachetime); |