Authenticating Users with a CGI script?

Authenticating Users with a CGI script?

Post by David Edward » Sun, 17 May 1998 04:00:00



Hello,

I have .htaccess set up to restrict access to a secure directory on
Apache 1.3b6 using a gdbm password file.  Right now Apache give the
username/password dialog box for authentication when somebody accesses
the secure directory.  I want to make something that looks nicer, like
a  web page with a username and password form, but I can't figure out
how to pass the username/password to Apache so Apache's built in prompt
will be bypassed, yet the user will be authenticated.

Any suggestions?
david

 
 
 

Authenticating Users with a CGI script?

Post by Thornton Prim » Mon, 18 May 1998 04:00:00



> I have .htaccess set up to restrict access to a secure directory on
> Apache 1.3b6 using a gdbm password file.  Right now Apache give the
> username/password dialog box for authentication when somebody accesses
> the secure directory.  I want to make something that looks nicer, like
> a  web page with a username and password form, but I can't figure out
> how to pass the username/password to Apache so Apache's built in prompt
> will be bypassed, yet the user will be authenticated.

The key isn't passing the password and user name to Apache, but to the
webbrowser. In HTTP the server does not maintain state information on
clients (this is not entirely the case now with sessioning and cookies).
The state of authentication needs to be held in the browser client, and
not in the web server.

I don't know of any way of setting user name and password in the web
browser dynamically (with some server header or with some JavaScript).
If you could set HTTP authentication headers for clients from the
server, I would consider it a serious security flaw in the browser.

There are ways around this, notably you can use cookies or sessioning
instead of standard HTTP authentication, though I wouldn't recommend it.
Many websites use this approach where they are more concerened with
tracking users than protecting resources.

thornton

 
 
 

Authenticating Users with a CGI script?

Post by Marc Slemk » Mon, 15 Jun 1998 04:00:00





>> I don't know of any way of setting user name and password in the web
>> browser dynamically (with some server header or with some JavaScript).
>> If you could set HTTP authentication headers for clients from the
>> server, I would consider it a serious security flaw in the browser.
>You can actually display a login page, then redirect to

>information show up every time redirect to http://server/whatever from there.

You can do that with some clients, not necessarily all because it is
non-standard.