Webduino and Basic Authentication

1,226 views
Skip to first unread message

claykit

unread,
May 12, 2010, 9:48:36 AM5/12/10
to Webduino
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.

Ben Combee

unread,
May 12, 2010, 10:39:29 AM5/12/10
to webd...@googlegroups.com
Very cool! Could you post this as a bug on the Google Code page at
webduino.googlecode.com where you can include the ZIP file as an
attachment. I'll look at merging this when I do the next release,
probably about the time I teach the class again at Resistor.

On Wed, May 12, 2010 at 9:48 AM, claykit <cla...@kithouse.it> wrote:
> 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).

minishlyz

unread,
May 12, 2010, 8:29:45 PM5/12/10
to webd...@googlegroups.com
On 2010/05/12 23:39, Ben Combee wrote:
> Very cool! Could you post this as a bug on the Google Code page at
> webduino.googlecode.com where you can include the ZIP file as an
> attachment. I'll look at merging this when I do the next release,
> probably about the time I teach the class again at Resistor.
>
> On Wed, May 12, 2010 at 9:48 AM, claykit <cla...@kithouse.it> wrote:
>> > 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).

It's very interesting!

In several days, I've been working for our web site of Arduino and webduino.
I'm looking forward to be merged the new release.

If you are interested in our work, please visit web site "(+ Arduino
Lightyearz)".

https://sites.google.com/a/lyz.jp/arduino/

Many Japanese people are intersted in webduino, and I'm trying to
introduce and spread webduino in Japan.

claykit

unread,
May 13, 2010, 3:55:43 AM5/13/10
to Webduino
I upload the file in the code section as a bug, as required.

Claudio.
Reply all
Reply to author
Forward
0 new messages