• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# lws minimal http server basic auth
2
3This demonstrates how to protect a mount using a password
4file outside of the mount itself.
5
6The demo has two mounts, a normal one at / and one protected
7by basic auth at /secret.
8
9The file at ./ba-passwords contains valid user:password
10combinations.
11
12## Discovering the authenticated user
13
14After a successful authentication, the `WSI_TOKEN_HTTP_AUTHORIZATION` token
15contains the authenticated username.
16
17## build
18
19```
20 $ cmake . && make
21```
22
23## usage
24
25```
26 $ ./lws-minimal-http-server-basic-auth
27[2018/04/19 08:40:05:1333] USER: LWS minimal http server basic auth | visit http://localhost:7681
28[2018/04/19 08:40:05:1333] NOTICE: Creating Vhost 'default' port 7681, 1 protocols, IPv6 off
29```
30
31Visit http://localhost:7681, and follow the link there to the secret area.
32
33Give your browser "user" and "password" as the credentials.
34
35