[LON-CAPA-cvs] cvs: loncom /auth lonacc.pm migrateuser.pm switchserver.pm

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 02 Jun 2006 19:38:22 -0000


albertel		Fri Jun  2 15:38:22 2006 EDT

  Modified files:              
    /loncom/auth	lonacc.pm migrateuser.pm switchserver.pm 
  Log:
  - preserve the fact that we ssoed in
  
  
Index: loncom/auth/lonacc.pm
diff -u loncom/auth/lonacc.pm:1.77 loncom/auth/lonacc.pm:1.78
--- loncom/auth/lonacc.pm:1.77	Thu Apr 13 16:47:39 2006
+++ loncom/auth/lonacc.pm	Fri Jun  2 15:38:21 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Cookie Based Access Handler
 #
-# $Id: lonacc.pm,v 1.77 2006/04/13 20:47:39 albertel Exp $
+# $Id: lonacc.pm,v 1.78 2006/06/02 19:38:21 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -150,8 +150,10 @@
         $handle=~s/\W//g;
     }
       
+    my ($sso_login);
     if ($r->user 
 	&& (!$lonid || !-e "$lonidsdir/$handle.id" || $handle eq '') ) {
+	$sso_login = 1;
 	my $domain = $r->dir_config('lonDefDomain');
 	my $home=&Apache::lonnet::homeserver($r->user,$domain);
 	if ($home !~ /(con_lost|no_such_host)/) {
@@ -161,6 +163,10 @@
 	}
     }
 
+    if ($sso_login) {
+	&Apache::lonnet::appenv('request.sso.login' => 1);
+    }
+
     if ($r->dir_config("lonBalancer") eq 'yes') {
 	$r->set_handlers('PerlResponseHandler'=>
 			 [\&Apache::switchserver::handler]);
Index: loncom/auth/migrateuser.pm
diff -u loncom/auth/migrateuser.pm:1.6 loncom/auth/migrateuser.pm:1.7
--- loncom/auth/migrateuser.pm:1.6	Mon May 15 13:45:46 2006
+++ loncom/auth/migrateuser.pm	Fri Jun  2 15:38:21 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Starts a user off based of an existing token.
 #
-# $Id: migrateuser.pm,v 1.6 2006/05/15 17:45:46 albertel Exp $
+# $Id: migrateuser.pm,v 1.7 2006/06/02 19:38:21 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -49,6 +49,14 @@
 }
 
 
+sub sso_check {
+    my ($data) = @_;
+    if ($data->{'sso.login'}) {
+	&Apache::lonnet::appenv(('request.sso.login' =>
+				 $data->{'sso.login'} ));
+    }
+}
+
 sub handler {
     my ($r) = @_;
     
@@ -74,6 +82,7 @@
     if (!$data{'role'}) {
 	&Apache::lonauth::success($r,$data{'username'},$data{'domain'},
 				  $home,'/adm/roles');
+	&sso_check(\%data);
 	return OK;
     }
 
@@ -82,6 +91,7 @@
     
     &Apache::lonauth::success($r,$data{'username'},$data{'domain'},$home,
 			      $next_url);
+    &sso_check(\%data);
     return OK;
 }
 
Index: loncom/auth/switchserver.pm
diff -u loncom/auth/switchserver.pm:1.7 loncom/auth/switchserver.pm:1.8
--- loncom/auth/switchserver.pm:1.7	Wed Apr  5 18:39:55 2006
+++ loncom/auth/switchserver.pm	Fri Jun  2 15:38:21 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Switch Servers Handler
 #
-# $Id: switchserver.pm,v 1.7 2006/04/05 22:39:55 albertel Exp $
+# $Id: switchserver.pm,v 1.8 2006/06/02 19:38:21 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -103,6 +103,9 @@
 	      'username' => $env{'user.name'},
 	      'role'     => $env{'form.role'},
 	      'server'   => $r->dir_config('lonHostID'));
+    if ($env{'request.sso.login'}) {
+	$info{'sso.login'} = $env{'request.sso.login'};
+    }
     my $token = &Apache::lonnet::tmpput(\%info,$env{'form.otherserver'});
     my $switch='<meta HTTP-EQUIV="Refresh" CONTENT="0.5; url=http://'.$switch_to.'/adm/login?domain='.$env{'user.domain'}.'&username='.$env{'user.name'}.'&token='.$token.'">';
     my $start_page = &Apache::loncommon::start_page('Switching Server ...',