Hello,
I have been modified webduino to perform the Basic Authentication,
usefull for simple authentication to webduino web site on Arduino. (I
develop and tested the solution on Arduino Duemilanove with official
Ethernet shield).
The solution was to develop a derived class of WebServer called
WebServerAuth.
So, the only change to original WebServer class was the change of
keyword "private" in "protected" (IMPORTANT).
The constructor of new class has two new parameters, user and
password:
WebServerAuth(const char* user, const char* passwd, const char
*urlPrefix, int port);
The constructor transforms user and password into the base64 encoded
string that represent the client authentication request. This is
useful for a quick compare with client authentication request.
In Basic Authentication, when the browser send a GET (or other)
command like
GET /admin/index.html HTTP/1.0
Host: 192.168.0.100
the first time the server responds (webduino in our case) with an
authentication request
HTTP/1.0 401 Authorization Required
...
WWW-Authenticate: Basic realm="webduino"
Content-Type: text/html
After this, generally, the client (browser) requests username and
password to the user, and then renew the GET request with
authentication to the server:
GET /admin/index.html HTTP/1.0
Host: 192.168.0.100
Authorization: Basic YWRtaW46cGFzc3dvcmQ=
The string "YWRtaW46cGFzc3dvcmQ=" is the base64 encoded
"username:password" (in this case "admin:password").
If username and password are the same that we have inserted in the
constructor, the authentication is ok.
The code is in the uploaded file webduinoauth.zip. This archive
consists of three files:
- EncodeBase64.h containing the code for base64 encoding
- WebServerAuth.h containing the derived class
- WebServer.h that is the original webduino WebServer class (V1.4.1)
with the private keyword changed in protected.
Claykit.
--
You received this message because you are subscribed to the Google Groups "Webduino" group.
To post to this group, send email to
webd...@googlegroups.com.
To unsubscribe from this group, send email to
webduino+u...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/webduino?hl=en.