Basic HTTP authentication

H

Henrik Steensland

Hi!

I'm having serious troubles getting Basic HTTP authentication to work.
This code:
r=Apache::request
r.auth_type='Basic'
r.auth_name='Testing'
r.status=401
r.note_auth_failure
r.send_http_header

produces a nice dialog in my browser for identification.
However, when I type a user name and password, the script doens't seem to
receive it.
r.user is for instance nil.

If I put a .htaccess and a .htpasswd file in the directory and answer with a
valid username and password, then my script is able to get the username in
r.user.

What am I doing wrong? Is there a simple way around this?
I would like to use the CGI-library if possible and I'm writing in ruby and
eruby. I don't want to extend mod_ruby (which I'm using) or something like
that.

Regards Henrik
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top