Skip to content

Latest commit

 

History

History
68 lines (52 loc) · 1.67 KB

README.md

File metadata and controls

68 lines (52 loc) · 1.67 KB

elli_basicauth

Basic authentication middleware for elli

Hex.pm Erlang Travis CI Coverage Status

Installation

{deps, [
  {elli, "2.0.2"},
  {elli_basicauth, "0.1.0"}
]}.

Example

  • 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