LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Use Apache Basic Authentication with user-created form (https://www.linuxquestions.org/questions/programming-9/use-apache-basic-authentication-with-user-created-form-542775/)

ClarkWGriswold 04-02-2007 06:02 PM

Use Apache Basic Authentication with user-created form
 
I'm working on using mod_authz_ldap to do authentication for my application and I'm trying to avoid using the standard username/password box that Apache presents when trying to access a restricted page.

Is it possible to prevent the Apache login box from popping up and using a form within my html to post to *something* that will pass the login values to apache to perform the Basic Authentication?

I've read through the documentation and I don't recall seeing anything that might work. I'm not sure if this is even possible.

Thanks!!

j-ray 04-03-2007 04:11 AM

I'm not completely sure (90 % only) but i think that you have to manage a registered session with a script language like perl, php and cookies if you want a custom login. The basic-auth mechanism cannot be emulated by some html code.

ClarkWGriswold 04-03-2007 10:40 AM

Quote:

Originally Posted by j-ray
I'm not completely sure (90 % only) but i think that you have to manage a registered session with a script language like perl, php and cookies if you want a custom login. The basic-auth mechanism cannot be emulated by some html code.


That's kind of what I figured. I wasn't sure if it was even possible. It's been a while, but I thought I may have done something like this in the past. Something like setting PHP_AUTH_USER (in PHP: $_SERVER['AUTH_PHP_USER']) equal to the user name collected from the login script and *tricking* Apache into seeing this value set when accessing a protected realm, however, I don't think that would actually work. (works in my head, just not in reality :tisk: )

Anyone else ever try something like this?

wjsams 01-09-2008 03:51 PM

I think this might help.
 
This shows you how to read the .htpasswd file from PHP.

Sorry, I had to put spaces because I'm new here.

http : // koivi.com / php-http-auth /

This is used with basic authentication.


All times are GMT -5. The time now is 09:12 PM.