You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Peter Rothermel <Pe...@watchguard.com> on 2002/04/30 19:23:00 UTC
Help with Basic Auth mod_perl2
greetings,
I'm somewhat new to this group so please point me
to the FAQ if I'm asking the wrong questions for this
forum.
I'm trying to migrate from Apache 1.3 on Unix to Apache 2.0
on WinNT and I'm running into problems getting my perl modules
working. Here's the first of my problems:
I've added an Authentication Handler to a location that uses
basic auth and can't get this simple example from the Eagle book
running. It looks like $r->coonection->user is no longer supported.
If I use $r->user the auth handler works fine. I'm I not using Apache::compat
correctly?
Here's my auth handler:
sub authenBasic ($) {
my $r = shift;
my ($res, $sentpass) = $r->get_basic_auth_pw;
return $res if $res != OK;
# my $user = $r->user;
my $user = $r->connection->user;
unless ($user and $sentpass) {
$r->note_basic_auth_failure;
$r->log_reason("Both a username and password must be supplied",
$r->filename);
return AUTH_REQUIRED;
}
Here's the error message that gets sent to the browser:
Server error!
Error message:
Can't locate object method "user" via package "Apache::Connection" at C:\Apache2
/blib/lib/Apache/AgentAuthCookie.pm line 23.
If you think this is a server error, please contact the webmaster <mailto:@@ServerAdmin@@>
Error 500
localhost </>
04/30/2002 09:41:43 AM
Apache/2.0.36-dev (Win32) mod_perl/1.99_02-dev Perl/v5.6.0
Here's the entry in the error.log:
[Tue Apr 30 09:41:43 2002] [error] [client 127.0.0.1] Can't locate object method
"user" via package "Apache::Connection" at C:\Apache2/blib/lib/Apache/AgentAuthCookie.pm line 23.
In my httpd.conf file:
PerlSwitches -Mblib=C:\Apache2
PerlModule Apache2
<Location /hello>
PerlResponseHandler Apache::HelloWorld
SetHandler modperl
</Location>
PerlModule Apache::compat
PerlRequire "/apache2/conf/startup.pl"
Alias /modperl /apache2/perlmods
<Location /modperl>
SetHandler perl-script
Options ExecCGI
PerlSendHeader On
PerlOptions +GlobalRequest
PerlResponseHandler ModPerl::Registry
allow from all
</Location>
PerlModule Apache::WGTI::hello
PerlModule Apache::AgentAuthCookie
<Location /modperl/hello>
SetHandler perl-script
AuthType Basic
AuthName "WatchGuardAgentUser"
PerlAuthenHandler Apache::AgentAuthCookie::authenBasic
require valid-user
PerlHandler Apache::WGTI::hello
</Location>
In my startup.pl:
$ENV{MOD_PERL} or die "not running under mod_perl!";
use Apache2 ();
use Apache::compat ();
use Carp ();
use CGI ();
CGI->compile(':all');
CGI->compile(':standard');
use CGI::Carp;
use Apache::AgentAuthCookie;
1;
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: Help with Basic Auth mod_perl2
Posted by Doug MacEachern <do...@covalent.net>.
On Wed, 1 May 2002, Stas Bekman wrote:
> Peter, it's not implemented (yet). and it's not in compat.pm. There are
> quite a few unimplemented things (yet).
$r->connection->user will never be in compat.pm
notice that modperl-1.x has implemented this for compat long ago..
=item 1.24_01 - October 10, 2000
...
added Apache::user method in preparation for 2.0, now that `user' hangs
off of the request_rec rather than request_rec->connection in Apache 2.0
...
so any auth module should now be using $r->user instead of
$r->connection->user for 1.x or 2.0
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: Help with Basic Auth mod_perl2
Posted by Stas Bekman <st...@stason.org>.
Peter Rothermel wrote:
> Here's the entry in the error.log:
> [Tue Apr 30 09:41:43 2002] [error] [client 127.0.0.1] Can't locate object method
> "user" via package "Apache::Connection" at C:\Apache2/blib/lib/Apache/AgentAuthCookie.pm line 23.
Peter, it's not implemented (yet). and it's not in compat.pm. There are
quite a few unimplemented things (yet).
See the tests in t/ when in doubt. They cover pretty much all APIs which
are supported.
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: Help with Basic Auth mod_perl2
Posted by Per Einar Ellefsen <pe...@skynet.be>.
Peter: please subscribe to the users list, see
http://perl.apache.org/preview/modperl-docs/dst_html/maillist/list-modperl.html
for more information. That is where you should post questions like this,
not the development list which is exclusively for mod_perl core development.
I forwarded your e-mail to modperl@perl.apache.org, so that others can
reply there.
At 19:23 30.04.2002, Peter Rothermel wrote:
>greetings,
>
>I'm somewhat new to this group so please point me
>to the FAQ if I'm asking the wrong questions for this
>forum.
>
>I'm trying to migrate from Apache 1.3 on Unix to Apache 2.0
>on WinNT and I'm running into problems getting my perl modules
>working. Here's the first of my problems:
>
>I've added an Authentication Handler to a location that uses
>basic auth and can't get this simple example from the Eagle book
>running. It looks like $r->coonection->user is no longer supported.
>If I use $r->user the auth handler works fine. I'm I not using Apache::compat
>correctly?
>
>
>Here's my auth handler:
>
>sub authenBasic ($) {
> my $r = shift;
>
> my ($res, $sentpass) = $r->get_basic_auth_pw;
> return $res if $res != OK;
>
># my $user = $r->user;
> my $user = $r->connection->user;
> unless ($user and $sentpass) {
> $r->note_basic_auth_failure;
> $r->log_reason("Both a username and password must be supplied",
> $r->filename);
> return AUTH_REQUIRED;
> }
>
>Here's the error message that gets sent to the browser:
> Server error!
> Error message:
> Can't locate object method "user" via package
> "Apache::Connection" at C:\Apache2
> /blib/lib/Apache/AgentAuthCookie.pm line 23.
> If you think this is a server error, please contact the
> webmaster <mailto:@@ServerAdmin@@>
> Error 500
> localhost </>
> 04/30/2002 09:41:43 AM
> Apache/2.0.36-dev (Win32) mod_perl/1.99_02-dev Perl/v5.6.0
>
>
>Here's the entry in the error.log:
> [Tue Apr 30 09:41:43 2002] [error] [client 127.0.0.1] Can't locate
> object method
> "user" via package "Apache::Connection" at
> C:\Apache2/blib/lib/Apache/AgentAuthCookie.pm line 23.
>
>
>
>In my httpd.conf file:
>
>PerlSwitches -Mblib=C:\Apache2
>PerlModule Apache2
><Location /hello>
> PerlResponseHandler Apache::HelloWorld
> SetHandler modperl
></Location>
>
>PerlModule Apache::compat
>PerlRequire "/apache2/conf/startup.pl"
>
>Alias /modperl /apache2/perlmods
>
> <Location /modperl>
> SetHandler perl-script
> Options ExecCGI
> PerlSendHeader On
> PerlOptions +GlobalRequest
> PerlResponseHandler ModPerl::Registry
> allow from all
> </Location>
>
>PerlModule Apache::WGTI::hello
>PerlModule Apache::AgentAuthCookie
>
> <Location /modperl/hello>
> SetHandler perl-script
>
> AuthType Basic
> AuthName "WatchGuardAgentUser"
> PerlAuthenHandler Apache::AgentAuthCookie::authenBasic
> require valid-user
> PerlHandler Apache::WGTI::hello
> </Location>
>
>
>In my startup.pl:
>
>$ENV{MOD_PERL} or die "not running under mod_perl!";
>use Apache2 ();
>use Apache::compat ();
>
>use Carp ();
>use CGI ();
>CGI->compile(':all');
>CGI->compile(':standard');
>
>use CGI::Carp;
>
>use Apache::AgentAuthCookie;
>1;
--
Per Einar Ellefsen
per.einar@skynet.be