--- loncom/lonnet/perl/lonnet.pm 2021/09/21 22:54:27 1.1465 +++ loncom/lonnet/perl/lonnet.pm 2021/10/07 15:51:16 1.1467 @@ -1,7 +1,7 @@ # The LearningOnline Network # TCP networking package # -# $Id: lonnet.pm,v 1.1465 2021/09/21 22:54:27 raeburn Exp $ +# $Id: lonnet.pm,v 1.1467 2021/10/07 15:51:16 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -14387,10 +14387,15 @@ sub machine_ids { sub additional_machine_domains { my @domains; - open(my $fh,"<","$perlvar{'lonTabDir'}/expected_domains.tab"); - while( my $line = <$fh>) { - $line =~ s/\s//g; - push(@domains,$line); + if (-e "$perlvar{'lonTabDir'}/expected_domains.tab") { + if (open(my $fh,"<","$perlvar{'lonTabDir'}/expected_domains.tab")) { + while (my $line = <$fh>) { + chomp($line); + $line =~ s/\s//g; + push(@domains,$line); + } + close($fh); + } } return @domains; } @@ -14603,7 +14608,7 @@ sub use_proxy_alias { if ($alias) { my $dom = &host_domain($lonid); if ($dom ne '') { - my $proxyinfo = &get_proxy_settings($dom ); + my $proxyinfo = &get_proxy_settings($dom); my ($vpnint,$remote_ip); if (ref($proxyinfo) eq 'HASH') { $vpnint = $proxyinfo->{'vpnint'}; @@ -14617,6 +14622,35 @@ sub use_proxy_alias { } } return; +} + +sub alias_shibboleth { + my ($lonid) = @_; + if ($lonid eq '') { + $lonid = $perlvar{'lonHostID'}; + } + if (!defined(&hostname($lonid))) { + return; + } + if ($lonid ne '') { + my ($use_alias,$cached) = &is_cached_new('proxysaml',$lonid); + if ($cached) { + return $use_alias; + } + my $dom = &Apache::lonnet::host_domain($lonid); + if ($dom ne '') { + my $cachetime = 60*60*24; + my %domconfig = + &Apache::lonnet::get_dom('configuration',['wafproxy'],$dom); + if (ref($domconfig{'wafproxy'}) eq 'HASH') { + if (ref($domconfig{'wafproxy'}{'saml'}) eq 'HASH') { + $use_alias = $domconfig{'wafproxy'}{'saml'}{$lonid}; + } + } + return &do_cache_new('proxysaml',$lonid,$use_alias,$cachetime); + } + } + return; } sub get_saml_landing {