Johnny said:
Oh.... and what kind of encryption does the basic auth uses??
Thomas
HTTP Basic Authentication uses no encryption at all. Here's
a simplified outline of it:
A user clicks a link in their web browser, and the web server
recognizes that URL as protected with Basic Authentication.
The web server checks the HTTP request packet for a special
header, containing the username and password in plain,
Base-64 encoded text. There is no such header originally,
so the web server returns a special type of error message
to the browser.
The web browser gets the message and prompts the user to
enter a username and password. That information is
added to the HTTP request packet, and that packet is
sent again.
Now the web server sees the correct header, and looks up
the username and password someplace. If all is well the
request is honored and the protected web page is fetched
and returned.
All subsequent requests by your web browser to that same
protected part of the web (called a "realm") will automatically
include that authentication header. So you don't get
prompted for a username and password every time.
Note there is no DES or crypt used at all. Base-64
encoding is an alternative to ASCII encoding. This
is not the same thing as using encryption!
This scheme is so insecure that it should only be used
with HTTPS, which encrypts all parts of all packets.
Now you can use this with PHP. If your PHP script returns
the correct error message to the browser when the request
packet lacks the proper basic auth header, the user
will see the same dialog box pop up requesting a
username and password, for that "realm".
There is a lot of material on the web about secure PHP
pages,
http://phpsec.org/ for example.
What any of this has to do with Java, I don't know.
You can of course code up a servlet to do this, but
most of this stuff is built into Java already, as
some other posters have pointed out. Maybe you
should continue this discussion in a PHP newsgroup?
You might get more PHP experts answering you there!
-Wayne