Basic HTTP authentication

Discussion in 'Ruby' started by Henrik Steensland, Nov 29, 2003.

  1. 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
     
    Henrik Steensland, Nov 29, 2003
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alex Hunsley
    Replies:
    1
    Views:
    492
    Christophe Vanfleteren
    May 26, 2004
  2. Yodai

    HTTP basic authentication

    Yodai, Jan 6, 2004, in forum: C Programming
    Replies:
    3
    Views:
    404
    Mark A. Odell
    Jan 7, 2004
  3. Michael Foord

    HTTP - basic authentication example.

    Michael Foord, Sep 15, 2004, in forum: Python
    Replies:
    7
    Views:
    794
    Michael Foord
    Sep 22, 2004
  4. Max
    Replies:
    2
    Views:
    1,133
  5. Nacho Nachev
    Replies:
    2
    Views:
    944
Loading...

Share This Page