Web server basic authentication

Related to the development libraries, released by Curt Binder
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Web server basic authentication

Post by rimai »

Hi Guys,

I've added HTTP basic authentication to the webserver.
We failed to implement this in the past, but I think it should be stable this time.
It is currently in the dev branch.
This is the github issue: https://github.com/reefangel/Libraries/issues/154
If you get to test it, please post back here or log it into the github issue tracking whether it worked for you or not.
One point to remind is that your phone app will not work if you enable authentication.
Roberto.
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Web server basic authentication

Post by binder »

what version of libraries will this be added? 1.11? or something or later?

Sent from my Moto X
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Web server basic authentication

Post by rimai »

Yes, it will be available in the next one.
Roberto.
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Web server basic authentication

Post by binder »

The webserver authentication only works on the controller, correct?
This is not the same as the security key that is used for the portal....ie. ReefAngel.Portal(username, password)
Is that correct?

Then, using this authentication, you would use this url to communicate with your controller:

Code: Select all

http://user:pass@DEVICE_IP:PORT/
Hopefully I'm following correctly. Provided I am, I was going to implement this into my android app for those that wanted to test it out and use it.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Web server basic authentication

Post by rimai »

Yes, it is just basic authentication in the internal RA webserver and sending the url like you mentioned should work, although IE had problems understanding it for some reason, but firefox worked fine with an url like that.
Roberto.
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Web server basic authentication

Post by binder »

ok. good to know.
i'm going to add this in (doesn't look the best, but works for now).
ra_wifi_auth.png
ra_wifi_auth.png (63.93 KiB) Viewed 13231 times
and then allow people to test things out to see how well it works.
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Web server basic authentication

Post by binder »

Ok. I've got a working build for the webserver authentication. I'm going to sleep on it and verify things are working properly before I release it tomorrow. I have tested it on my controller at my desk and it works just fine communicating with a v1.1.0 controller with or without the authentication set. I am interested to see / hear how it works when the authentication is actually enabled. I may have to update my errors appropriately because I am not doing anything special for the authentication errors.
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Web server basic authentication

Post by binder »

just posted a beta release of my app that should incorporate the authentication. check my thread for a link to download it.
Smotz
Posts: 401
Joined: Sat Mar 30, 2013 5:02 pm
Location: CT, USA

Re: Web server basic authentication

Post by Smotz »

this is awesome! you guys freaking rock!
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Web server basic authentication

Post by binder »

Smotz wrote:this is awesome! you guys freaking rock!
thanks. i decided i would try to stay up on things if i could. :)
Smotz
Posts: 401
Joined: Sat Mar 30, 2013 5:02 pm
Location: CT, USA

Re: Web server basic authentication

Post by Smotz »

Sorry but I am not getting it...how do I enable authentication on my RA webpage?
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Web server basic authentication

Post by binder »

Smotz wrote:Sorry but I am not getting it...how do I enable authentication on my RA webpage?
You need to grab the latest copy of the libraries from the DEV branch. Then you must add this to your setup() of your INO.

Code: Select all

ReefAngel.Network.WifiAuthentication("username:password");
Then, that will require that username and password combination to access your controller through the web page.
So you could do:

Code: Select all

ReefAngel.Network.WifiAuthentication("myuser:pass4321");
Or whatever else you wanted to do. The only requirement is that string of your username:password must be 50 chars or less, including the colon (:).
Smotz
Posts: 401
Joined: Sat Mar 30, 2013 5:02 pm
Location: CT, USA

Re: Web server basic authentication

Post by Smotz »

binder wrote:
Smotz wrote:Sorry but I am not getting it...how do I enable authentication on my RA webpage?
You need to grab the latest copy of the libraries from the DEV branch. Then you must add this to your setup() of your INO.

Code: Select all

ReefAngel.Network.WifiAuthentication("username:password");
Then, that will require that username and password combination to access your controller through the web page.
So you could do:

Code: Select all

ReefAngel.Network.WifiAuthentication("myuser:pass4321");
Or whatever else you wanted to do. The only requirement is that string of your username:password must be 50 chars or less, including the colon (:).
This is perfect! Thank you as always.

Can I have multiple lines for multiple usernames?
Will this affect the portal in anyway?
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Web server basic authentication

Post by binder »

Smotz wrote: This is perfect! Thank you as always.

Can I have multiple lines for multiple usernames?
No
Will this affect the portal in anyway?
I think it will because the portal will have to use the username and password to connect to your controller. However, I believe Roberto has this implemented and working now so the portal can connect but I am not 100% positive. He (or someone else) will have to confirm this (also, I have not checked, but I'm sure you could check on the portal for some authentication).
Smotz
Posts: 401
Joined: Sat Mar 30, 2013 5:02 pm
Location: CT, USA

Re: Web server basic authentication

Post by Smotz »

binder wrote:
Smotz wrote: This is perfect! Thank you as always.

Can I have multiple lines for multiple usernames?
No
Will this affect the portal in anyway?
I think it will because the portal will have to use the username and password to connect to your controller. However, I believe Roberto has this implemented and working now so the portal can connect but I am not 100% positive. He (or someone else) will have to confirm this (also, I have not checked, but I'm sure you could check on the portal for some authentication).
Gotcha - Everything is working except the portal.
Roberto, can you chime in? I cannot figure out where on the portal to set this.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Web server basic authentication

Post by rimai »

Not implemented yet.
Roberto.
Smotz
Posts: 401
Joined: Sat Mar 30, 2013 5:02 pm
Location: CT, USA

Re: Web server basic authentication

Post by Smotz »

rimai wrote:Not implemented yet.
Gotcha. Well, looks good so far!
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Web server basic authentication

Post by Sacohen »

Was the Webserver Authentication enabled on the Portal after the update to the 1.1.1 libraries.

I uncommented it from my code and when I load the portal I get Unreachable Address and it pulls the info from the database.

When I comment it out again the portal works fine.

Code: Select all

ReefAngel.Network.WifiAuthentication("Sacohen:xxxxxxxx");
With the xxx's representing my actual password.

It is in my setup section.

Does the password need to be the same as what the portal uses or the Portal key?
For example the portal or forum password maybe ABCDefgh but my Portal key is AbCdEfGh
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Web server basic authentication

Post by Sacohen »

I tried changing my forum password to match my Portal Key and the Server Authentication in my code and still got Unreachable Address.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Web server basic authentication

Post by rimai »

Not implemented yet :(
I'll try to get to this next week.
Roberto.
Smotz
Posts: 401
Joined: Sat Mar 30, 2013 5:02 pm
Location: CT, USA

Re: Web server basic authentication

Post by Smotz »

following
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Web server basic authentication

Post by Sacohen »

Thanks Roberto
pandimus
Posts: 213
Joined: Mon Apr 01, 2013 7:58 pm

Re: Web server basic authentication

Post by pandimus »

This wouldn't happen to be the reason I've been getting authentication errors is it?
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Web server basic authentication

Post by Sacohen »

Authentication errors where???

Have you added the web authentication to your code?
pandimus
Posts: 213
Joined: Mon Apr 01, 2013 7:58 pm

Re: Web server basic authentication

Post by pandimus »

I get it constantly on the Android app, I haven't added any code.
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Web server basic authentication

Post by Sacohen »

Then no.
The Android app has the authentication in it already.

Try changing your timeout time and # of retries.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Web server basic authentication

Post by rimai »

I added controller authentication username and password fields to your user profile page.
Please go there and enter the same username and password you coded in your controller.
The portal should recognize it and apply the authentication automatically.
Please let me know how it goes.
Roberto.
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Web server basic authentication

Post by Sacohen »

Where are the authentication username and password fields?
I don't see them.
I looked under the portal settings and nothing new is there.

Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Web server basic authentication

Post by rimai »

On your forum user profile page.
It's a more secure place to have them stored.
Roberto.
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Web server basic authentication

Post by Sacohen »

Works great. Thanks.
I don't really use the U-App, but it would need to be added to that when you have a chance.
The Andiod App works great.

I'll try to get Russ at Reftronic to implement something on this page.
Post Reply