bwindels / wwwee

wwwee, the wee webserver: a small, robust, low-resource and fast web application server for low workloads (home server, personal cloud)
GNU General Public License v3.0
26 stars 1 forks source link

Implement http basic auth #8

Closed bwindels closed 5 years ago

bwindels commented 6 years ago

Using https://gist.github.com/bwindels/777a1b5b13cd54bcd67dca3c925ca7bb as a base64 decoder, parse the authorization header into an Authorization enum, of which Basic contains a struct with username and password.

bwindels commented 6 years ago

add static-website feature as we need some form of authentication to allow file upload for uploading static assets.

bwindels commented 5 years ago

needs a http handlers as well that can be used as middleware, like so:

let auth_handler = app::BasicAuthHandler(child_handler, |username, password| {
  username == "foo" && password == "bar"
});

Maybe not for the initial version, but would be good to think if we want to look up the username and password in something that needs to perform an async action, what the api should look like.