You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by "Kiran Kumar.M" <ki...@comatindia.com> on 2001/03/03 08:28:34 UTC

Authentication handlers

hi ,
i'm using mod_perl authentication handler, where the user's credentials are checked against a database  and in the database i have a flag which tells the login status (y|n),  but aftr the user logs out the status is changed to n , my problem is that after logging out if the user  goes one page back and submits the browser sends the username and password again , and the status is changed to y . Is there any means of removing the username and password from the browsers cache.

Thanks in advance

Kiran

Re: Authentication handlers

Posted by Erdmut Pfeifer <e....@science-computing.de>.
On Mon, Mar 05, 2001 at 10:28:15AM +1100, Sisyphus wrote:
> 
> 
> ----- Original Message -----
> From: Pierre Phaneuf <pp...@sx.nec.com>
> To: modperl <mo...@apache.org>
> Sent: Monday, March 05, 2001 9:29 AM
> Subject: Re: Authentication handlers
> 
> 
> > Cees Hek wrote:
> >
> > > So instead of storing a y/n in the database, store a unique string that
> is
> > > used as the realm, and clear it when they log out.  Now everytime you
> send
> > > the Authenitication required header, send the unique realm for this user
> > > that you stored in the database, and if it doesn't exist, generate a new
> > > one.
> >
> > Good one! The only bad thing I see is that the realm is visible in the
> > dialog box the user see, isn't it? Seeing a random string might be a bit
> > unsettling for the user, but there is no technical reason for it not to
> > work.
> >
> > --
> > Pierre Phaneuf
> > Systems Exorcist
> 
> Hi,
> Are you guys sure about this ? I just tried it out and it doesn't work for
> Apache1.3.12(win32) on win 98.
> I visited a page in a 'basic authentication' protected directory, then
> changed the name of the realm from 'htdocs access' to 'htdocs' but was still
> able to access other pages in the same directory without being hit for
> username and password. I tried hitting the back button and 'refreshing', and
> I also visited another site in the interim. All to no avail.

Hi,

there are two things to consider here. First, the server really has to
send the AUTH_REQUIRED + realm; second, the browser does have to honor
that authentication request by asking the user for a new name/password.

Typically, servers are set up not to send the AUTH_REQUIRED response
code, when the browser already is sending a valid username/password
combination. And that's where browser caching comes into play: having
queried the user once for username/password, the browser associates it
with that specific URL and automatically resends it for each subsequent
request to that location (which usually makes sense as it avoids another
round trip to the server).
Now, what happens if the server is configured such that it sends an
AUTH_REQUIRED, even though it did already get the basic authorization
header?  Well, as so often, it depends on the browser. Netscape, for
example, does pop up a dialog box, asking for re-authentication, while
IE simply resends the same old username/password combination again.
Thus, in IE you don't get a chance to enter any new credentials for a
certain location which you've already visited in the current browser
session. M$ obviously thought that this would never make sense ;(
(it effectively means that you have to restart IE, if you need to
login anew...)

I haven't yet tested this issue again to see what happens when bringing
the "changing realms"-idea into play. Maybe an AUTH_REQUIRED + _new_
realm would even convince IE to allow re-authentication... ;)

Erdmut


-- 
Erdmut Pfeifer
science+computing gmbh

-- Bugs come in through open windows. Keep Windows shut! --

Re: Authentication handlers

Posted by Sisyphus <ka...@hdc.com.au>.

----- Original Message -----
From: Pierre Phaneuf <pp...@sx.nec.com>
To: modperl <mo...@apache.org>
Sent: Monday, March 05, 2001 9:29 AM
Subject: Re: Authentication handlers


> Cees Hek wrote:
>
> > So instead of storing a y/n in the database, store a unique string that
is
> > used as the realm, and clear it when they log out.  Now everytime you
send
> > the Authenitication required header, send the unique realm for this user
> > that you stored in the database, and if it doesn't exist, generate a new
> > one.
>
> Good one! The only bad thing I see is that the realm is visible in the
> dialog box the user see, isn't it? Seeing a random string might be a bit
> unsettling for the user, but there is no technical reason for it not to
> work.
>
> --
> Pierre Phaneuf
> Systems Exorcist

Hi,
Are you guys sure about this ? I just tried it out and it doesn't work for
Apache1.3.12(win32) on win 98.
I visited a page in a 'basic authentication' protected directory, then
changed the name of the realm from 'htdocs access' to 'htdocs' but was still
able to access other pages in the same directory without being hit for
username and password. I tried hitting the back button and 'refreshing', and
I also visited another site in the interim. All to no avail.
Cheers,
Rob Gilmour
Visit our website at http://www.kalinabears.com.au


push_handlers question

Posted by Mike Cameron <mc...@mirusweb.com>.
I am trying to sub class Apache::AuthCookieURL and would like to use
$r->push_handlers(PerlAuthenHandler => My::Class->authenticate);
the push_handler is set in a handler called from httpd.conf on the
PerlInitHandler phase but the authenticate routine does not seem to be getting
the apache request object passed to it as I get a can't call dir_config on an
udefined value error.

I'm sure I am missing something simple but can someone point it out to me.

Thanks


Re: Authentication handlers

Posted by Cees Hek <ce...@sitesuite.net>.
On Sun, 4 Mar 2001, Pierre Phaneuf wrote:

> Good one! The only bad thing I see is that the realm is visible in the
> dialog box the user see, isn't it? Seeing a random string might be a bit
> unsettling for the user, but there is no technical reason for it not to
> work.

Well, since the only requirement is that it is different from the last
Realm you sent, (ie it doesn't need to be unique across all users), you
could easily use the date and time.  Something like 

Secure Area (Mar 5, 2001 10:51:02)

This would have the side effect of also telling you when the user logged
in.  You would have to check the RFC to see what the size limit is on a
Realm.


-- 
Cees


Re: Authentication handlers

Posted by Pierre Phaneuf <pp...@sx.nec.com>.
Cees Hek wrote:

> So instead of storing a y/n in the database, store a unique string that is
> used as the realm, and clear it when they log out.  Now everytime you send
> the Authenitication required header, send the unique realm for this user
> that you stored in the database, and if it doesn't exist, generate a new
> one.

Good one! The only bad thing I see is that the realm is visible in the
dialog box the user see, isn't it? Seeing a random string might be a bit
unsettling for the user, but there is no technical reason for it not to
work.

-- 
Pierre Phaneuf
Systems Exorcist

Re: Authentication handlers

Posted by Cees Hek <ce...@sitesuite.net>.
On Sat, 3 Mar 2001, Kiran Kumar.M wrote:

> hi , i'm using mod_perl authentication handler, where the user's
> credentials are checked against a database and in the database i have
> a flag which tells the login status (y|n), but aftr the user logs out
> the status is changed to n , my problem is that after logging out if
> the user goes one page back and submits the browser sends the username
> and password again , and the status is changed to y . Is there any
> means of removing the username and password from the browsers cache.
>

I'm assuming you are using Basic Authentication here...

I haven't used Basic Authentication in a couple years now, but I seem to
remember that you can specify a 'Realm' in which the username and password
is valid.  If you change this realm when the user logs out, then they will
be prompted for their username and password again.

So instead of storing a y/n in the database, store a unique string that is
used as the realm, and clear it when they log out.  Now everytime you send
the Authenitication required header, send the unique realm for this user
that you stored in the database, and if it doesn't exist, generate a new
one.

-- 
Cees


Re: Authentication handlers

Posted by "Paul J. Lucas" <pa...@mac.com>.
On Sat, 3 Mar 2001, Pierre Phaneuf wrote:

> "Paul J. Lucas" wrote:
> 
> > > Is there any means of removing the username and password from the browsers
> > > cache.
> > 
> >         $r->nocache(1);
> 
> No, I think he's talking about the "basic" authentication information,
> that browsers keep in memory until they are stopped.

	Oh, silly me.  Since this is a mod_perl mailing list, I thought
	it was actually mod_perl question.

	Basic authentication is basic authentication; mod_perl has
	nothing to do with it.

	- Paul


Re: Authentication handlers

Posted by Pierre Phaneuf <pp...@ludusdesign.com>.
"Paul J. Lucas" wrote:

> > Is there any means of removing the username and password from the browsers
> > cache.
> 
>         $r->nocache(1);

No, I think he's talking about the "basic" authentication information,
that browsers keep in memory until they are stopped.

I think that if you give them an AUTH_REQUIRED, it might clear the
password, but that would also make the authentication dialog box appear
on their machine, which would be rather confusing.

Personally, I use cookies for authentication instead, you can remove
those at will.

-- 
Pierre Phaneuf
http://www3.sympatico.ca/pphaneuf/

Re: Authentication handlers

Posted by "Paul J. Lucas" <pa...@mac.com>.
On Sat, 3 Mar 2001, Kiran Kumar.M wrote:

> Is there any means of removing the username and password from the browsers
> cache.

	$r->nocache(1);

	- Paul