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