Diff for /loncom/auth/checkauthen.pm between versions 1.5 and 1.15

version 1.5, 2006/06/05 15:08:48 version 1.15, 2014/01/05 11:30:06
Line 36  use Apache::lonnet; Line 36  use Apache::lonnet;
 sub handler {  sub handler {
     my ($r) = @_;      my ($r) = @_;
   
     if ($r->auth_type() eq 'Basic') {      if ($r->uri() =~ m{^/res/adm/pages/[^/]+\.(gif|png)$}) {
           if ($r->user() eq '') {
               $r->user('public');
           }
           return OK;
       }
   
       if (&Apache::lonnet::is_domainimage($r->uri)) {
           if ($r->user() eq '') {
               $r->user('public');
           }
           return OK;
       }
   
       if ($r->auth_type() ne 'LONCAPA') {
  return DECLINED;   return DECLINED;
     }      }
     my $fail = FORBIDDEN;       my $fail = FORBIDDEN; 
     if ($r->dir_config('lonOtherAuthen') eq 'yes') {      if ($r->dir_config('lonOtherAuthen') eq 'yes') {
    if (defined($r->dir_config('lonOtherAuthenType'))) {
               $r->auth_type($r->dir_config('lonOtherAuthenType'));
           }
  #&Apache::lonnet::logthis("other authen");   #&Apache::lonnet::logthis("other authen");
  $fail = DECLINED;   $fail = DECLINED;
     }      }
Line 48  sub handler { Line 65  sub handler {
     if ($env{'user.name'} eq 'public'       if ($env{'user.name'} eq 'public' 
  && $env{'user.domain'} eq 'public') {   && $env{'user.domain'} eq 'public') {
  if ($env{'request.publicaccess'} ) {   if ($env{'request.publicaccess'} ) {
               if ($r->user() eq '') {
                   $r->user('public');
               }
     return OK;      return OK;
  } else {   } else {
     return $fail;      return $fail;
  }   }
     }      }
   
     my %cookies=CGI::Cookie->parse($r->header_in('Cookie'));      my %user;
     my $lonid=$cookies{'lonID'};      my $handle = &Apache::lonnet::check_for_valid_session($r,undef,\%user);
     my $cookie;      if ($handle eq '') {
     if ($lonid) {          $handle = $env{'user.environment'};
  my $handle=$lonid->value;          if (($handle ne '') && ($r->user() eq '')) {
         $handle=~s/\W//g;              if ($env{'user.domain'} eq $r->dir_config('lonDefDomain')) {
         my $lonidsdir=$r->dir_config('lonIDsDir');                  $r->user($env{'user.name'});
         if ((-e "$lonidsdir/$handle.id") && ($handle ne '')) {                  } else {
     return OK;                  $r->user($env{'user.name'}.':'.$env{'user.domain'});
  }              }
           }
     }      }
   
       if ($handle ne '') {
           if ($r->user() eq '') {
               if ($user{'domain'} eq $r->dir_config('lonDefDomain')) {
                   $r->user($user{'name'});
               } else {
                   $r->user($user{'name'}.':'.$user{'domain'});
               }
           }
           return OK;
       }
       if (($fail == FORBIDDEN) &&
           (($r->uri eq '/adm/email') || ($r->uri eq '/adm/preferences') ||
            ($r->uri eq '/adm/requestcourse'))) {
           $env{'form.firsturl'} = $r->uri;
       }
     return $fail;      return $fail;
 }  }
   

Removed from v.1.5  
changed lines
  Added in v.1.15


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