File: README.md

package info (click to toggle)
libwebsockets 4.3.5-2
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 31,288 kB
  • sloc: ansic: 194,407; javascript: 1,550; sh: 1,387; cpp: 505; java: 461; perl: 405; xml: 118; makefile: 76; awk: 5
file content (34 lines) | stat: -rw-r--r-- 868 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# lws minimal http server basic auth

This demonstrates how to protect a mount using a password
file outside of the mount itself.

The demo has two mounts, a normal one at / and one protected
by basic auth at /secret.

The file at ./ba-passwords contains valid user:password
combinations.

## Discovering the authenticated user

After a successful authentication, the `WSI_TOKEN_HTTP_AUTHORIZATION` token
contains the authenticated username.

## build

```
 $ cmake . && make
```

## usage

```
 $ ./lws-minimal-http-server-basic-auth
[2018/04/19 08:40:05:1333] USER: LWS minimal http server basic auth | visit http://localhost:7681
[2018/04/19 08:40:05:1333] NOTICE: Creating Vhost 'default' port 7681, 1 protocols, IPv6 off
```

Visit http://localhost:7681, and follow the link there to the secret area.

Give your browser "user" and "password" as the credentials.