Esp32CameraRover2
Esp32CameraRover2 copied to clipboard
Implement basic authentication for the rover's web ui and web socket api
Currently any one can control the robot if they have or can guess its IP address. We want to add optional basic authentication such that the user can configure username and password that is compiled into the firmware and is used for basic authentication. If either the username or the password is empty then no authentication is done. If both the username and password are not empty then they are used as the credentials for the web ui and web socket api as follows:
- The use is challenged for a username and password using the browser's default basic authentication dialog when the user opens the web ui.
- The web server checks the
Authorization
header for the web ui GET and the web socket GET as follows;- If the
Authorization
header is missing then the request fails with a 401 Not Authorized response - If the
Authorization
header exists but does not match the configured username and password then the request fails with a 403 Forbidden response. - If valid of the
Authorization
header matches the configured username and password then the requests succeed.
- If the