File:  [LON-CAPA] / loncom / auth / lontokacc.pm
Revision 1.1: download - view: text, annotated - select for diffs
Sat Jul 27 18:48:19 2002 UTC (21 years, 11 months ago) by www
Branches: MAIN
CVS tags: HEAD
Bug #481
Simple token-based access mechanism.

    1: # The LearningOnline Network
    2: # Low security Access Handler for Token-based access 
    3: # (clearance given by other loncapa host)
    4: #
    5: # $Id: lontokacc.pm,v 1.1 2002/07/27 18:48:19 www Exp $
    6: #
    7: # Copyright Michigan State University Board of Trustees
    8: #
    9: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
   10: #
   11: # LON-CAPA is free software; you can redistribute it and/or modify
   12: # it under the terms of the GNU General Public License as published by
   13: # the Free Software Foundation; either version 2 of the License, or
   14: # (at your option) any later version.
   15: #
   16: # LON-CAPA is distributed in the hope that it will be useful,
   17: # but WITHOUT ANY WARRANTY; without even the implied warranty of
   18: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   19: # GNU General Public License for more details.
   20: #
   21: # You should have received a copy of the GNU General Public License
   22: # along with LON-CAPA; if not, write to the Free Software
   23: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   24: #
   25: # /home/httpd/html/adm/gpl.txt
   26: #
   27: # http://www.lon-capa.org/
   28: #
   29: 
   30: package Apache::lontokacc;
   31: 
   32: use strict;
   33: use Apache::Constants qw(:common :remotehost);
   34: use Apache::lonnet();
   35: use Apache::loncommon();
   36: 
   37: sub handler {
   38:     my $r = shift;
   39:     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
   40:     ['token','server']);
   41:     if (($ENV{'form.token'}) || ($ENV{'form.server'})) {
   42:         my $tmpinfo=Apache::lonnet::reply('tmpget:'.$ENV{'form.token'},
   43:                                                     $ENV{'form.server'});
   44: 
   45:         if ($tmpinfo eq $r->uri) {
   46: 	   return OK;
   47:         }
   48:     }
   49:     $r->log_reason("Invalid token-based access",$r->filename); 
   50:     return FORBIDDEN;
   51: }
   52: 
   53: 1;
   54: __END__
   55: 
   56: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>