wisp_basic_auth

Types

pub type ClientAuth =
  #(String, String)

Values

pub fn validate_basic_auth(
  request: request.Request(@internal Connection),
  realm: String,
  known_clients: List(#(String, String)),
  handler: fn(request.Request(@internal Connection)) -> response.Response(
    wisp.Body,
  ),
) -> response.Response(wisp.Body)

Middleware that validates an Authorization: Basic header against a known list of client ids and passwords within a realm.

The basic authentication scheme is based on the model that the user agent must authenticate itself with a user-ID and a password for each realm.

The realm value should be considered an opaque string which can only be compared for equality with other realms on that server.

Example header: Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==

use request <- validate_basic_auth("Agrabah", [#("Aladdin", "open sesame")])
Search Document