wisp_basic_auth

Wisp middleware of the Basic Authentication Scheme.

The basic authentication scheme is a non-secure method of filtering unauthorized access to resources on an HTTP server. It is based on the assumption that the connection between the client and the server can be regarded as a trusted carrier. As this is not generally true on an open network, the basic authentication scheme should be used accordingly.

Package Version Hex Docs

gleam add wisp_basic_auth@1

Prepend the middleware in your handler or router:

import wisp_basic_auth

const realm = "Secure"
const known_clients = [#("Aladdin", "open sesame")]

pub fn handle_request(request: Request) -> Response {
  use request <- validate_basic_auth(realm, known_clients)
  wisp.ok()
}

Further documentation can be found at https://hexdocs.pm/wisp_basic_auth.

Development

gleam test
Search Document