version 1.187, 2021/02/09 22:17:40
|
version 1.195, 2021/10/25 15:23:34
|
Line 305 sub sso_login {
|
Line 305 sub sso_login {
|
my $query = $r->args; |
my $query = $r->args; |
my %form; |
my %form; |
if ($query) { |
if ($query) { |
my @items = ('role','symb','iptoken'); |
my @items = ('role','symb','iptoken','origurl','ltoken','linkkey'); |
&Apache::loncommon::get_unprocessed_cgi($query,\@items); |
&Apache::loncommon::get_unprocessed_cgi($query,\@items); |
foreach my $item (@items) { |
foreach my $item (@items) { |
if (defined($env{'form.'.$item})) { |
if (defined($env{'form.'.$item})) { |
Line 323 sub sso_login {
|
Line 323 sub sso_login {
|
} |
} |
} |
} |
|
|
|
my ($linkprot,$linkkey); |
|
if ($form{'ltoken'}) { |
|
my %link_info = &Apache::lonnet::tmpget($form{'ltoken'}); |
|
$linkprot = $link_info{'linkprot'}; |
|
my $delete = &Apache::lonnet::tmpdel($form{'ltoken'}); |
|
} |
|
if ($form{'linkkey'} ne '') { |
|
$linkkey = $form{'linkkey'}; |
|
} |
|
|
my $domain = $r->dir_config('lonSSOUserDomain'); |
my $domain = $r->dir_config('lonSSOUserDomain'); |
if ($domain eq '') { |
if ($domain eq '') { |
$domain = $r->dir_config('lonDefDomain'); |
$domain = $r->dir_config('lonDefDomain'); |
Line 349 sub sso_login {
|
Line 359 sub sso_login {
|
my $lowest_load; |
my $lowest_load; |
($otherserver,undef,undef,undef,$lowest_load) = &Apache::lonnet::choose_server($domain); |
($otherserver,undef,undef,undef,$lowest_load) = &Apache::lonnet::choose_server($domain); |
if ($lowest_load > 100) { |
if ($lowest_load > 100) { |
$otherserver = &Apache::lonnet::spareserver($lowest_load,$lowest_load,1,$domain); |
$otherserver = &Apache::lonnet::spareserver($r,$lowest_load,$lowest_load,1,$domain); |
} |
} |
if ($otherserver ne '') { |
if ($otherserver ne '') { |
my @hosts = &Apache::lonnet::current_machine_ids(); |
my @hosts = &Apache::lonnet::current_machine_ids(); |
Line 367 sub sso_login {
|
Line 377 sub sso_login {
|
foreach my $item (keys(%form)) { |
foreach my $item (keys(%form)) { |
$env{'form.'.$item} = $form{$item}; |
$env{'form.'.$item} = $form{$item}; |
} |
} |
unless ($form{'symb'}) { |
unless (($form{'symb'}) || ($form{'origurl'})) { |
unless (($r->uri eq '/adm/roles') || ($r->uri eq '/adm/sso')) { |
unless (($r->uri eq '/adm/roles') || ($r->uri eq '/adm/sso')) { |
$env{'form.origurl'} = $r->uri; |
$env{'form.origurl'} = $r->uri; |
} |
} |
} |
} |
|
if (($r->uri eq '/adm/sso') && ($form{'origurl'} =~ m{^/+tiny/+$match_domain/+\w+$})) { |
|
$env{'request.deeplink.login'} = $form{'origurl'}; |
|
} elsif ($r->uri =~ m{^/+tiny/+$match_domain/+\w+$}) { |
|
$env{'request.deeplink.login'} = $r->uri; |
|
} |
|
if ($env{'request.deeplink.login'}) { |
|
if ($linkprot) { |
|
$env{'request.linkprot'} = $linkprot); |
|
} elsif ($linkkey ne '') { |
|
$env{'request.linkkey'} = $linkkey); |
|
} |
|
} |
$env{'request.sso.login'} = 1; |
$env{'request.sso.login'} = 1; |
if (defined($r->dir_config("lonSSOReloginServer"))) { |
if (defined($r->dir_config("lonSSOReloginServer"))) { |
$env{'request.sso.reloginserver'} = |
$env{'request.sso.reloginserver'} = |
Line 393 sub sso_login {
|
Line 415 sub sso_login {
|
'server' => $r->dir_config('lonHostID'), |
'server' => $r->dir_config('lonHostID'), |
'sso.login' => 1 |
'sso.login' => 1 |
); |
); |
foreach my $item ('role','symb','iptoken') { |
foreach my $item ('role','symb','iptoken','origurl') { |
if (exists($form{$item})) { |
if (exists($form{$item})) { |
$info{$item} = $form{$item}; |
$info{$item} = $form{$item}; |
} |
} |
} |
} |
unless ($info{'symb'}) { |
unless (($info{'symb'}) || ($info{'origurl'})) { |
unless (($r->uri eq '/adm/roles') || ($r->uri eq '/adm/sso')) { |
unless (($r->uri eq '/adm/roles') || ($r->uri eq '/adm/sso')) { |
$info{'origurl'} = $r->uri; |
$info{'origurl'} = $r->uri; |
} |
} |
} |
} |
|
if (($r->uri eq '/adm/sso') && ($form{'origurl'} =~ m{^/+tiny/+$match_domain/+\w+$})) { |
|
$info{'deeplink.login'} = $form{'origurl'}; |
|
} elsif ($r->uri =~ m{^/+tiny/+$match_domain/+\w+$}) { |
|
$info{'deeplink.login'} = $r->uri; |
|
} |
|
if ($info{'deeplink.login'}) { |
|
if ($linkprot) { |
|
$info{'linkprot'} = $linkprot; |
|
} elsif ($linkkey ne '') { |
|
$info{'linkkey'} = $linkkey; |
|
} |
|
} |
if ($r->dir_config("ssodirecturl") == 1) { |
if ($r->dir_config("ssodirecturl") == 1) { |
$info{'origurl'} = $r->uri; |
$info{'origurl'} = $r->uri; |
} |
} |
Line 559 sub handler {
|
Line 593 sub handler {
|
my $hostname = $r->hostname(); |
my $hostname = $r->hostname(); |
my $lonhost = &Apache::lonnet::host_from_dns($hostname); |
my $lonhost = &Apache::lonnet::host_from_dns($hostname); |
if ($lonhost) { |
if ($lonhost) { |
my $actual = &Apache::lonnet::absolute_url($hostname); |
my $actual = &Apache::lonnet::absolute_url($hostname,1,1); |
my $exphostname = &Apache::lonnet::hostname($lonhost); |
my $exphostname = &Apache::lonnet::hostname($lonhost); |
my $expected = $Apache::lonnet::protocol{$lonhost}.'://'.$hostname; |
my $expected = $Apache::lonnet::protocol{$lonhost}.'://'.$hostname; |
unless ($actual eq $expected) { |
unless ($actual eq $expected) { |
Line 673 sub handler {
|
Line 707 sub handler {
|
if ((!$env{'request.role.adv'}) && ($env{'acc.randomout'}) && |
if ((!$env{'request.role.adv'}) && ($env{'acc.randomout'}) && |
($env{'acc.randomout'}=~/\&\Q$poss_symb\E\&/)) { |
($env{'acc.randomout'}=~/\&\Q$poss_symb\E\&/)) { |
undef($poss_symb); |
undef($poss_symb); |
|
} elsif ((!$env{'request.role.adv'}) && ($env{'acc.deeplinkout'}) && |
|
($env{'acc.deeplinkout'}=~/\&\Q$poss_symb\E\&/)) { |
|
undef($poss_symb); |
} |
} |
} |
} |
} |
} |
Line 682 sub handler {
|
Line 719 sub handler {
|
$access=&Apache::lonnet::allowed('bre',$requrl,'','','','',1); |
$access=&Apache::lonnet::allowed('bre',$requrl,'','','','',1); |
} |
} |
} else { |
} else { |
$access=&Apache::lonnet::allowed('bre',$requrl); |
my $nodeeplinkcheck; |
|
if (($check_access) && ($requrl =~ /\.(sequence|page)$/)) { |
|
unless ($env{'form.navmap'}) { |
|
if ($r->args ne '') { |
|
&Apache::loncommon::get_unprocessed_cgi($r->args,['navmap']); |
|
unless ($env{'form.navmap'}) { |
|
$nodeeplinkcheck = 1; |
|
} |
|
} |
|
} |
|
} |
|
$access=&Apache::lonnet::allowed('bre',$requrl,'','','','','',$nodeeplinkcheck); |
} |
} |
} |
} |
if ($check_block) { |
if ($check_block) { |
Line 875 sub handler {
|
Line 923 sub handler {
|
} |
} |
if ($invalidsymb) { |
if ($invalidsymb) { |
if ($requrl eq '/adm/navmaps') { |
if ($requrl eq '/adm/navmaps') { |
undef(symb); |
undef($symb); |
} else { |
} else { |
$r->log_reason('Invalid symb for '.$requrl.': '.$symb); |
$r->log_reason('Invalid symb for '.$requrl.': '.$symb); |
$env{'user.error.msg'}= |
$env{'user.error.msg'}= |