Annotation of loncom/auth/lonacc.pm, revision 1.2
1.1 albertel 1: # The LearningOnline Network
2: # Cookie Based Access Handler
1.2 ! www 3: # 5/21/99,5/22,5/29,5/31,6/15,16/11 Gerd Kortemeyer
1.1 albertel 4:
5: package Apache::lonacc;
6:
7: use strict;
8: use Apache::Constants qw(:common);
1.2 ! www 9: use Apache::File;
1.1 albertel 10: use CGI::Cookie();
11:
12: sub handler {
13: my $r = shift;
14: my $requrl=$r->uri;
15: my %cookies=CGI::Cookie->parse($r->header_in('Cookie'));
16: my $lonid=$cookies{'lonID'};
17: my $cookie;
18: if ($lonid) {
19: my $handle=$lonid->value;
20: $handle=~s/\W//g;
21: my $lonidsdir=$r->dir_config('lonIDsDir');
22: if ((-e "$lonidsdir/$handle.id") && ($handle ne '')) {
1.2 ! www 23: my @profile;
! 24: {
! 25: my $idf=Apache::File->new("$lonidsdir/$handle.id");
! 26: @profile=<$idf>;
! 27: }
! 28: my $envi;
! 29: for ($envi=0;$envi<=$#profile;$envi++) {
! 30: chomp($profile[$envi]);
! 31: my ($envname,$envvalue)=split(/=/,$profile[$envi]);
! 32: $r->subprocess_env("profile.$envname" => "$envvalue");
! 33: }
! 34: $r->subprocess_env("request.state" => "published");
! 35: return OK;
1.1 albertel 36: } else {
37: $r->log_reason("Cookie $handle not valid", $r->filename)
38: };
39: }
40: $cookie=CGI::Cookie->new(-name => 'lonURL',
41: -value => $requrl,
42: -path => '/');
43: $r->err_headers_out->add('Set-Cookie' => $cookie);
44: return FORBIDDEN;
45: }
46:
47: 1;
48: __END__
49:
50:
51:
52:
53:
54:
55:
56:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>