I'm assuming that you're doing this in an access handler.  If
that's the case, set up some condition in your module where it figures out
whether or not the user is authenticated.  If the user isn't
authenticated:

        return(AUTH_REQUIRED);

        That should do it.  I don't think that'll return the error page
stating that you need access to continue, instead that should pass a
header (I think two actually) to the browser signaling it to prompt the
user.
        Another alternative would be to have the user redirected to a
login page with good old fashion forms.  ;)  Good luck.  --SC


        PS  If you're really interested in details of this, check out:

        <http://www.modperl.com/book/chapters/ch6.html>


--
Sean Chittenden


On 13 Feb 2000, Louis-David Mitterrand wrote:

> Date: 13 Feb 2000 14:09:08 -0000
> From: Louis-David Mitterrand <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED]
> To: [EMAIL PROTECTED]
> Subject: emulating Basic Auth from Mason
> 
> I have this component which both displays and updates a database. 
> 
> If the user wants to update a record I'd like the following to happen:
> 
> 1) detect in the component that a DB update is attempted,
> 
> 2) check if the user is already logged in by checking for login/password
> presence in the Apache::Session %session hash,
> 
> 3) if not, then instruct Apache to return a Basic Auth dialog prompting
> for login/password,
>     3.1) get the login/password from the $r object and store it in
>     %session,
> 
> The tough part (and this is where a lack of mod_perl experience shows)
> is: how do I tell Apache put itself in "Basic Auth mode" so that it will
> prompt the user for his login/password? And it has to work in a Mason
> environment.
> 
> I am digging into the mod_perl Guide at present for hints, but if
> someone could give me just a quick shove up the learning curve it would
> really help.
> 
> Thanks in advance,
> 
> 

-- 
Sean Chittenden
[EMAIL PROTECTED]
(408)530-0001

Reply via email to