[LON-CAPA-cvs] cvs: loncom /auth migrateuser.pm
raeburn
raeburn at source.lon-capa.org
Sun Oct 5 09:49:11 EDT 2014
raeburn Sun Oct 5 13:49:11 2014 EDT
Modified files:
/loncom/auth migrateuser.pm
Log:
Bug 6675 (IP change detected in session migration).
LON-CAPA domain configuration for multi-domain server set-ups.
- Support configuration of loadbalancer server for both non-SSO users and
SSO users for all LON-CAPA domains which are hosted on servers belonging
to the balancer's "internet domain".
Index: loncom/auth/migrateuser.pm
diff -u loncom/auth/migrateuser.pm:1.21 loncom/auth/migrateuser.pm:1.22
--- loncom/auth/migrateuser.pm:1.21 Sat Oct 4 02:59:32 2014
+++ loncom/auth/migrateuser.pm Sun Oct 5 13:49:11 2014
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Starts a user off based of an existing token.
#
-# $Id: migrateuser.pm,v 1.21 2014/10/04 02:59:32 raeburn Exp $
+# $Id: migrateuser.pm,v 1.22 2014/10/05 13:49:11 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -72,23 +72,26 @@
if (ref($dataref) eq 'HASH') {
my $title = 'LON-CAPA Session redirected';
my $message = &mt('Your internet address has changed since you logged in.');
- my $camefrom = &Apache::lonnet::hostname($dataref->{'server'});
- my $frombalancer = $dataref->{'balancer'};
my $rule_in_effect;
- if ($frombalancer) {
- my $balancerdom = &Apache::lonnet::host_domain($dataref->{'server'});
- if ($dataref->{'sso.login'}) {
- if (&Apache::lonnet::domain($dataref->{'domain'})) {
- $balancerdom = $dataref->{'domain'};
- }
+ if ($dataref->{'balancer'}) {
+ my $baldom = &Apache::lonnet::host_domain($camefrom);
+ my $balprimaryid = &Apache::lonnet::domain($baldom,'primary');
+ my $balintdom = &Apache::lonnet::internet_dom($balprimaryid);
+ my $uprimaryid = &Apache::lonnet::domain($udom,'primary');
+ my $uintdom = &Apache::lonnet::internet_dom($uprimaryid);
+ my $dom_in_use;
+ if (($uintdom ne '') && ($uintdom eq $balintdom)) {
+ $dom_in_use = $udom;
+ } else {
+ $dom_in_use = $baldom;
}
- my ($result,$cached)=&Apache::lonnet::is_cached_new('loadbalancing',$balancerdom);
+ my ($result,$cached)=&Apache::lonnet::is_cached_new('loadbalancing',$dom_in_use);
unless (defined($cached)) {
my $cachetime = 60*60*24;
my %domconfig =
- &Apache::lonnet::get_dom('configuration',['loadbalancing'],$balancerdom);
+ &Apache::lonnet::get_dom('configuration',['loadbalancing'],$dom_in_use);
if (ref($domconfig{'loadbalancing'}) eq 'HASH') {
- $result = &Apache::lonnet::do_cache_new('loadbalancing',$balancerdom,
+ $result = &Apache::lonnet::do_cache_new('loadbalancing',$dom_in_use,
$domconfig{'loadbalancing'},$cachetime);
}
}
More information about the LON-CAPA-cvs
mailing list