[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cgiapp] Re: cgiapp::Plugin::Authentication problem with proteced runmodes


Hi Cees,

Where is this coming from:  CGI::Application::Plugin::Authen ?

That should be CGI::Application::Plugin::Authentication

Is it possible that you have specified that somewhere in your code? It would help if you could show a code example of how to recreate this
problem?

Below is a code example. I found out that the problematic part is Webprob->authen->is_protected_runmode($rm), see the comment in the code. If this is commented out everything is fine. If not the script dies when changing from a protected to an unprotected rm, in this case to "outside".

Cheers, Uli

------------------------------------
package Webprob;
use strict;

use base 'CGI::Application';
use CGI::Application::Plugin::Authentication;

use CGI::Carp qw(fatalsToBrowser);

my @protected = qw(welcome logout);
my @unprotected = qw(outside);
my %rm;
foreach my $rm (@protected,@unprotected) { $rm{$rm} = $rm ; }

my %users = ( uli => "test" );
Webprob->authen->config(
		       DRIVER => [ 'Generic', \%users ],
		       STORE =>  ['Cookie',
				  SECRET => "psst",
				  ],
		       POST_LOGIN_RUNMODE => 'welcome'
		      );

Webprob->authen->protected_runmodes(@protected);

sub setup {
  my $self = shift;
  $self->start_mode('welcome');
  $self->run_modes( %rm  );
}

sub welcome {
  my $self = shift;
  return $self->page;
}

sub logout {
  my $self = shift;
  $self->authen->logout();
  return $self->page;
}

sub outside {
  my $self = shift;
  return $self->page;
}

sub page {
  my $self = shift;
  my $rm = $self->get_current_runmode;
  my $out;
  $out .= "<html><head><title>$rm</title></head><body>";
  $out .= "<h1>$rm</h1>";

#----------- this is the problematic part: -------------
  if (Webprob->authen->is_protected_runmode($rm)) {
    $out .= "$rm is protected";
  } else {
    $out .= "$rm is not protected";
  }
#-------------------------------------------------------

  $out .= "<p>";
  foreach my $r (keys %rm) {
    $out .= "[<a href='?rm=$r'>$r</a>]" unless $r eq $rm;
  }
  $out .= "</body></html>";
}

1;



---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/suppressed/
             http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.