Commit 6837b64
committed
http: server-side Digest Auth with htdigest file support
Add server-side HTTP Digest Auth support using the standard htdigest
file format (username:realm:HA1_hex per line).
- New mount auth mode LWSAUTHM_DIGEST_AUTH
- New mount field basic_auth_realm for the auth realm
- lws_check_digest_auth() parses Authorization: Digest headers and
validates against the htdigest file
- lws_unauthorised_digest_auth() sends 401 with a fresh random nonce
- Nonce is stored per-wsi and verified on keep-alive retries
- Constant-time response comparison via lws_timingsafe_bcmp
- Wired into HTTP/1.1, HTTP/2 and WS upgrade paths
- Added minimal example minimal-http-server-digestauth
- LWS_WITH_HTTP_DIGEST_AUTH now implies LWS_WITH_HTTP_BASIC_AUTH so
the shared lws_authorization_rewrite helper is available
Signed-off-by: Bastian Germann <bage@debian.org>
Co-developed-by: Claude Sonnet 4.61 parent 4e59faf commit 6837b64
13 files changed
Lines changed: 872 additions & 1 deletion
File tree
- include/libwebsockets
- lib
- core-net
- roles
- h2
- http
- server
- ws
- minimal-examples-lowlevel/http-server/minimal-http-server-digestauth
- mount-origin
- mount-secret-origin
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
274 | 274 | | |
275 | 275 | | |
276 | 276 | | |
| 277 | + | |
277 | 278 | | |
278 | 279 | | |
279 | 280 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1505 | 1505 | | |
1506 | 1506 | | |
1507 | 1507 | | |
1508 | | - | |
| 1508 | + | |
| 1509 | + | |
1509 | 1510 | | |
1510 | 1511 | | |
1511 | 1512 | | |
| |||
1557 | 1558 | | |
1558 | 1559 | | |
1559 | 1560 | | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
1560 | 1567 | | |
1561 | 1568 | | |
1562 | 1569 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
147 | 152 | | |
148 | 153 | | |
149 | 154 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
938 | 938 | | |
939 | 939 | | |
940 | 940 | | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
941 | 962 | | |
942 | 963 | | |
943 | 964 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
306 | 306 | | |
307 | 307 | | |
308 | 308 | | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
309 | 313 | | |
310 | 314 | | |
311 | 315 | | |
| |||
342 | 346 | | |
343 | 347 | | |
344 | 348 | | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
345 | 357 | | |
346 | 358 | | |
347 | 359 | | |
| |||
0 commit comments