[LON-CAPA-cvs] cvs: loncom /auth lonacc.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Tue, 29 Nov 2005 21:12:04 -0000
albertel Tue Nov 29 16:12:04 2005 EDT
Modified files:
/loncom/auth lonacc.pm
Log:
- changes needed to support making loacc a authz handler
- add ability 'lonBalancer' to force all sesions to be offloaded
Index: loncom/auth/lonacc.pm
diff -u loncom/auth/lonacc.pm:1.69 loncom/auth/lonacc.pm:1.70
--- loncom/auth/lonacc.pm:1.69 Wed Nov 23 15:46:04 2005
+++ loncom/auth/lonacc.pm Tue Nov 29 16:12:03 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Cookie Based Access Handler
#
-# $Id: lonacc.pm,v 1.69 2005/11/23 20:46:04 www Exp $
+# $Id: lonacc.pm,v 1.70 2005/11/29 21:12:03 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -44,10 +44,31 @@
my %cookies=CGI::Cookie->parse($r->header_in('Cookie'));
my $lonid=$cookies{'lonID'};
my $cookie;
+ my $lonidsdir=$r->dir_config('lonIDsDir');
+
+ my $handle;
if ($lonid) {
- my $handle=$lonid->value;
+ $handle=$lonid->value;
$handle=~s/\W//g;
- my $lonidsdir=$r->dir_config('lonIDsDir');
+ }
+
+ if ($r->user
+ && (!$lonid || !-e "$lonidsdir/$handle.id" || $handle eq '') ) {
+ my $domain = $r->dir_config('lonDefDomain');
+ my $home=&Apache::lonnet::homeserver($r->user,$domain);
+ if ($home !~ /(con_lost|no_such_host)/) {
+ $handle=&Apache::lonauth::success($r,$r->user,$domain,
+ $home,'noredirect');
+ $r->header_out('Set-cookie',"lonID=$handle; path=/");
+ }
+ }
+
+ if ($r->dir_config("lonBalancer") eq 'yes') {
+ $r->set_handlers('PerlResponseHandler'=>
+ [\&Apache::switchserver::handler]);
+ }
+
+ if ($handle ne '') {
if ((-e "$lonidsdir/$handle.id") && ($handle ne '')) {
# ------------------------------------------------------ Initialize Environment