version 1.146, 2013/12/01 21:29:10
|
version 1.147, 2013/12/05 05:19:14
|
Line 264 sub upload_size_allowed {
|
Line 264 sub upload_size_allowed {
|
=item sso_login() |
=item sso_login() |
|
|
handle the case of the single sign on user, at this point $r->user |
handle the case of the single sign on user, at this point $r->user |
will be set and valid now need to find the loncapa user info and possibly |
will be set and valia;d now need to find the loncapa user info, and possibly |
balance them |
balance them. If Apache >= 2.4, $r->user() will also have been set so |
|
$curruser is checked, and if null, this is an SSO case. |
returns OK if it was a SSO and user was handled |
returns OK if it was a SSO and user was handled |
undef if not SSO or no means to hanle the user |
undef if not SSO or no means to hanle the user |
|
|
=cut |
=cut |
|
|
sub sso_login { |
sub sso_login { |
my ($r,$handle) = @_; |
my ($r,$handle,$curruser) = @_; |
|
|
my $lonidsdir=$r->dir_config('lonIDsDir'); |
my $lonidsdir=$r->dir_config('lonIDsDir'); |
if (($r->user eq '') || |
if (($r->user eq '') || ($curruser ne '') || |
(defined($env{'user.name'}) && (defined($env{'user.domain'})) |
(defined($env{'user.name'}) && (defined($env{'user.domain'})) |
&& ($handle ne ''))) { |
&& ($handle ne ''))) { |
# not an SSO case or already logged in |
# not an SSO case or already logged in |
Line 339 sub sso_login {
|
Line 340 sub sso_login {
|
} else { |
} else { |
# need to login them in, so generate the need data that |
# need to login them in, so generate the need data that |
# migrate expects to do login |
# migrate expects to do login |
my %info=('ip' => $r->connection->remote_ip(), |
my $ip; |
|
my $c = $r->connection; |
|
eval { |
|
$ip = $c->remote_ip(); |
|
}; |
|
if ($@) { |
|
$ip = $c->client_ip(); |
|
} |
|
my %info=('ip' => $ip, |
'domain' => $domain, |
'domain' => $domain, |
'username' => $user, |
'username' => $user, |
'server' => $r->dir_config('lonHostID'), |
'server' => $r->dir_config('lonHostID'), |
Line 404 sub handler {
|
Line 413 sub handler {
|
return OK; |
return OK; |
} |
} |
|
|
my $handle = &Apache::lonnet::check_for_valid_session($r); |
my $curruser; |
|
my $handle = &Apache::lonnet::check_for_valid_session($r,undef,\$curruser); |
|
|
my $result = &sso_login($r,$handle); |
my $result = &sso_login($r,$handle,$curruser); |
if (defined($result)) { |
if (defined($result)) { |
return $result; |
return $result; |
} |
} |