version 1.195, 2021/10/25 15:23:34
|
version 1.201, 2021/11/30 15:55:40
|
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','origurl','ltoken','linkkey'); |
my @items = ('role','symb','iptoken','origurl','ttoken', |
|
'ltoken','linkkey','logtoken','sso'); |
&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 324 sub sso_login {
|
Line 325 sub sso_login {
|
} |
} |
|
|
my ($linkprot,$linkkey); |
my ($linkprot,$linkkey); |
if ($form{'ltoken'}) { |
|
|
# |
|
# If Shibboleth auth is in use, and a dual SSO and non-SSO login page |
|
# is in use, then the query string will contain the logtoken item with |
|
# a value set to the name of a .tmp file in /home/httpd/perl/tmp |
|
# containing the url to display after authentication, and also, |
|
# optionally, role and symb, or linkprot or linkkey (deep-link access). |
|
# |
|
# If Shibboleth auth is in use, but a dual log-in page is not in use, |
|
# and the originally requested URL was /tiny/$domain/$id (i.e., |
|
# for deeplinking), then the query string will contain the sso item |
|
# with a value set to the name of a .tmp file in /home/httpd/perl/tmp |
|
# containing the url to display after authentication, and also, |
|
# optionally, linkprot or linkkey (deep-link access). |
|
# |
|
# Otherwise the query string may contain role and symb, or if the |
|
# originally requested URL was /tiny/$domain/$id (i.e. for deeplinking) |
|
# then the query string may contain a ttoken item with a value set |
|
# to the name of a .tmp file in /home/httpd/perl/tmp containing either |
|
# linkprot or linkkey (deep-link access). |
|
# |
|
# If deep-linked, i.e., the originally requested URL was /tiny/$domain/$id |
|
# the linkkey may have originally been sent in POSTed data, which will |
|
# have been processed in lontrans.pm |
|
# |
|
|
|
if ($form{'ttoken'}) { |
|
my %info = &Apache::lonnet::tmpget($form{'ttoken'}); |
|
&Apache::lonnet::tmpdel($form{'ttoken'}); |
|
if ($info{'origurl'}) { |
|
$form{'origurl'} = $info{'origurl'}; |
|
} |
|
if ($info{'linkprot'}) { |
|
$linkprot = $info{'linkprot'}; |
|
} elsif ($info{'linkkey'} ne '') { |
|
$linkkey = $info{'linkkey'}; |
|
} |
|
} elsif ($form{'logtoken'}) { |
|
my ($firsturl,@rest); |
|
my $lonhost = $r->dir_config('lonHostID'); |
|
my $tmpinfo = &Apache::lonnet::reply('tmpget:'.$form{'logtoken'},$lonhost); |
|
my $delete = &Apache::lonnet::tmpdel($form{'logtoken'}); |
|
unless (($tmpinfo=~/^error/) || ($tmpinfo eq 'con_lost') || |
|
($tmpinfo eq 'no_such_host')) { |
|
(undef,$firsturl,@rest) = split(/&/,$tmpinfo); |
|
if ($firsturl ne '') { |
|
$firsturl = &unescape($firsturl); |
|
} |
|
foreach my $item (@rest) { |
|
my ($key,$value) = split(/=/,$item); |
|
$form{$key} = &unescape($value); |
|
} |
|
if ($firsturl =~ m{^/tiny/$match_domain/\w+$}) { |
|
$form{'origurl'} = $firsturl; |
|
} |
|
if ($form{'linkprot'}) { |
|
$linkprot = $form{'linkprot'}; |
|
} elsif ($form{'linkkey'} ne '') { |
|
$linkkey = $form{'linkkey'}; |
|
} |
|
if ($form{'iptoken'}) { |
|
%sessiondata = &Apache::lonnet::tmpget($form{'iptoken'}); |
|
my $delete = &Apache::lonnet::tmpdel($form{'iptoken'}); |
|
} |
|
} |
|
} elsif ($form{'sso'}) { |
|
my $lonhost = $r->dir_config('lonHostID'); |
|
my $info = &Apache::lonnet::reply('tmpget:'.$form{'sso'},$lonhost); |
|
&Apache::lonnet::tmpdel($form{'sso'}); |
|
unless (($info=~/^error/) || ($info eq 'con_lost') || |
|
($info eq 'no_such_host')) { |
|
my ($firsturl,@rest)=split(/\&/,$info); |
|
if ($firsturl ne '') { |
|
$form{'origurl'} = &unescape($firsturl); |
|
} |
|
foreach my $item (@rest) { |
|
my ($key,$value) = split(/=/,$item); |
|
$form{$key} = &unescape($value); |
|
} |
|
if ($form{'linkprot'}) { |
|
$linkprot = $form{'linkprot'}; |
|
} elsif ($form{'linkkey'} ne '') { |
|
$linkkey = $form{'linkkey'}; |
|
} |
|
} |
|
} elsif ($form{'ltoken'}) { |
my %link_info = &Apache::lonnet::tmpget($form{'ltoken'}); |
my %link_info = &Apache::lonnet::tmpget($form{'ltoken'}); |
$linkprot = $link_info{'linkprot'}; |
$linkprot = $link_info{'linkprot'}; |
my $delete = &Apache::lonnet::tmpdel($form{'ltoken'}); |
my $delete = &Apache::lonnet::tmpdel($form{'ltoken'}); |
} |
delete($form{'ltoken'}); |
if ($form{'linkkey'} ne '') { |
} elsif ($form{'linkkey'} ne '') { |
$linkkey = $form{'linkkey'}; |
$linkkey = $form{'linkkey'}; |
} |
} |
|
|
Line 389 sub sso_login {
|
Line 475 sub sso_login {
|
} |
} |
if ($env{'request.deeplink.login'}) { |
if ($env{'request.deeplink.login'}) { |
if ($linkprot) { |
if ($linkprot) { |
$env{'request.linkprot'} = $linkprot); |
$env{'request.linkprot'} = $linkprot; |
} elsif ($linkkey ne '') { |
} elsif ($linkkey ne '') { |
$env{'request.linkkey'} = $linkkey); |
$env{'request.linkkey'} = $linkkey; |
} |
} |
} |
} |
$env{'request.sso.login'} = 1; |
$env{'request.sso.login'} = 1; |
Line 418 sub sso_login {
|
Line 504 sub sso_login {
|
foreach my $item ('role','symb','iptoken','origurl') { |
foreach my $item ('role','symb','iptoken','origurl') { |
if (exists($form{$item})) { |
if (exists($form{$item})) { |
$info{$item} = $form{$item}; |
$info{$item} = $form{$item}; |
|
} elsif ($sessiondata{$item} ne '') { |
|
$info{$item} = $sessiondata{$item}; |
} |
} |
} |
} |
unless (($info{'symb'}) || ($info{'origurl'})) { |
unless (($info{'symb'}) || ($info{'origurl'})) { |
Line 474 sub sso_login {
|
Line 562 sub sso_login {
|
$r->subprocess_env->set('SSOUserUnknown' => $user); |
$r->subprocess_env->set('SSOUserUnknown' => $user); |
$r->subprocess_env->set('SSOUserDomain' => $domain); |
$r->subprocess_env->set('SSOUserDomain' => $domain); |
if (grep(/^sso$/,@cancreate)) { |
if (grep(/^sso$/,@cancreate)) { |
|
#FIXME - need to preserve origurl, role and symb, or linkprot or linkkey for use after account |
|
# creation |
$r->set_handlers('PerlHandler'=> [\&Apache::createaccount::handler]); |
$r->set_handlers('PerlHandler'=> [\&Apache::createaccount::handler]); |
$r->handler('perl-script'); |
$r->handler('perl-script'); |
} else { |
} else { |
Line 513 sub handler {
|
Line 603 sub handler {
|
if ($handle eq '') { |
if ($handle eq '') { |
unless ((($requrl eq '/adm/switchserver') && (!$r->is_initial_req())) || |
unless ((($requrl eq '/adm/switchserver') && (!$r->is_initial_req())) || |
($requrl =~ m{^/public/$match_domain/$match_courseid/syllabus}) || |
($requrl =~ m{^/public/$match_domain/$match_courseid/syllabus}) || |
($requrl =~ m{^/adm/help/}) || |
($requrl =~ m{^/adm/help/}) || ($requrl eq '/adm/sso') || |
($requrl =~ m{^/res/$match_domain/$match_username/})) { |
($requrl =~ m{^/res/$match_domain/$match_username/})) { |
$r->log_reason("Cookie not valid", $r->filename); |
$r->log_reason("Cookie not valid", $r->filename); |
} |
} |
Line 626 sub handler {
|
Line 716 sub handler {
|
if (($found_server) && ($balancer_cookie =~ /^\Q$env{'user.domain'}\E_\Q$env{'user.name'}\E_/)) { |
if (($found_server) && ($balancer_cookie =~ /^\Q$env{'user.domain'}\E_\Q$env{'user.name'}\E_/)) { |
$otherserver = $found_server; |
$otherserver = $found_server; |
} |
} |
unless ($requrl eq '/adm/switchserver') { |
unless ($requrl eq '/adm/switchserver') { |
$r->set_handlers('PerlResponseHandler'=> |
$r->set_handlers('PerlResponseHandler'=> |
[\&Apache::switchserver::handler]); |
[\&Apache::switchserver::handler]); |
} |
} |
Line 730 sub handler {
|
Line 820 sub handler {
|
} |
} |
} |
} |
} |
} |
$access=&Apache::lonnet::allowed('bre',$requrl,'','','','','',$nodeeplinkcheck); |
my $clientip = &Apache::lonnet::get_requestor_ip($r); |
|
$access=&Apache::lonnet::allowed('bre',$requrl,'','',$clientip,'','',$nodeeplinkcheck); |
} |
} |
} |
} |
if ($check_block) { |
if ($check_block) { |
Line 788 sub handler {
|
Line 879 sub handler {
|
} |
} |
} |
} |
} elsif (($handle =~ /^publicuser_\d+$/) && (&Apache::lonnet::is_portfolio_url($requrl))) { |
} elsif (($handle =~ /^publicuser_\d+$/) && (&Apache::lonnet::is_portfolio_url($requrl))) { |
my $clientip = &Apache::lonnet::get_requestor_ip($r); |
my $clientip = &Apache::lonnet::get_requestor_ip($r); |
if (&Apache::lonnet::allowed('bre',$requrl,undef,undef,$clientip) ne 'F') { |
if (&Apache::lonnet::allowed('bre',$requrl,undef,undef,$clientip) ne 'F') { |
$env{'user.error.msg'}="$requrl:bre:1:1:Access Denied"; |
$env{'user.error.msg'}="$requrl:bre:1:1:Access Denied"; |
return HTTP_NOT_ACCEPTABLE; |
return HTTP_NOT_ACCEPTABLE; |
Line 857 sub handler {
|
Line 948 sub handler {
|
my ($map,$mid,$murl)=&Apache::lonnet::decode_symb($symb); |
my ($map,$mid,$murl)=&Apache::lonnet::decode_symb($symb); |
if ($map =~ /\.page$/) { |
if ($map =~ /\.page$/) { |
my $mapsymb = &Apache::lonnet::symbread($map); |
my $mapsymb = &Apache::lonnet::symbread($map); |
($map,$mid,$murl)=&Apache::lonnet::decode_symb($mapsymb); |
($map,$mid,$murl)=&Apache::lonnet::decode_symb($mapsymb); |
} |
} |
&Apache::lonnet::symblist($map,$murl => [$murl,$mid], |
&Apache::lonnet::symblist($map,$murl => [$murl,$mid], |
'last_known' =>[$murl,$mid]); |
'last_known' =>[$murl,$mid]); |