Basic authentication middleware for elli
{deps, [
{elli, "2.0.2"},
{elli_basicauth, "0.1.0"}
]}.
-
Start an Erlang shell with elli and elli_basicauth loaded.
rebar3 as test shell
-
Start elli_basicauth_example.
1> {ok, Pid} = elli_basicauth_example:start_link().
-
Make requests, e.g. using HTTPie.
http :8080/protected
HTTP/1.1 401 Unauthorized Connection: Keep-Alive Content-Length: 12 WWW-Authenticate: Basic realm="Admin Area" Unauthorized
http -a user:pass :8080/protected
HTTP/1.1 403 Forbidden Connection: Keep-Alive Content-Length: 9 Forbidden