cvsandbox / cam2web

Streaming camera to web as MJPEG stream or individual JPEG snapshots. Providing embedded web UI for watching camera directly from a web browser.
http://www.cvsandbox.com/projects/cam2web/
GNU General Public License v2.0
183 stars 72 forks source link

URL with credentials #11

Open frakman1 opened 5 years ago

frakman1 commented 5 years ago

Hi Andrew,

Thanks for making an awesome and useful utility like this.

After adding User Access Control, I would like to know what URL format to use that allows me to pass in the username and password directly without having to enter them in the popup. I've tried these variations without any luck:

http://myuser:mypassword@ip:port/camera/mjpeg and http://ip:port/camera/mjpeg&u=myuser&p=mypassword

Any idea if this is possible or not?

andrewkirillov commented 5 years ago

Hello,

This is not possible at this point. Some code changes need to be done to support it.

cam2web uses Digest authentication instead of Basic. With Basic authentication you would be allowed to send user name/password in plain as you would like. However in Digest authentication a hash function is applied to password, so it is not send in clear.

https://en.wikipedia.org/wiki/Basic_access_authentication https://en.wikipedia.org/wiki/Digest_access_authentication

May need to see what can be done. The best might be to default to Digest, but accept Basic as well if user chose to use it. If not, maybe a configuration option could be used.

cvsandbox commented 4 years ago

Just an update. Windows version was updated about 2 months ago to support Basic authentication, so user/password can be put into URL.

frakman1 commented 4 years ago

Fantastic! Can you provide example syntax please?

cvsandbox commented 4 years ago

As you mentioned it before: http://myuser:mypassword@ip:port/camera/mjpeg or to access Web UI http://myuser:mypassword@ip:port

I did not make an official buid. If you are happy to get latest code and build it, then you can test it quickly. Otherwise I can make a build.

The new version should accept both Digest and Basic authentication. However in configuration UI, there is an option to specify default method, which is requested from clients which are not yet authenticated.