Annotate

mod_http_favicon/mod_http_favicon.lua @ 5193:2bb29ece216b

mod_http_oauth2: Implement stateless dynamic client registration Replaces previous explicit registration that required either the additional module mod_adhoc_oauth2_client or manually editing the database. That method was enough to have something to test with, but would not probably not scale easily. Dynamic client registration allows creating clients on the fly, which may be even easier in theory. In order to not allow basically unauthenticated writes to the database, we implement a stateless model here. per_host_key := HMAC(config -> oauth2_registration_key, hostname) client_id := JWT { client metadata } signed with per_host_key client_secret := HMAC(per_host_key, client_id) This should ensure everything we need to know is part of the client_id, allowing redirects etc to be validated, and the client_secret can be validated with only the client_id and the per_host_key. A nonce injected into the client_id JWT should ensure nobody can submit the same client metadata and retrieve the same client_secret
author Kim Alvefur <zash@zash.se>
date Fri, 03 Mar 2023 21:14:19 +0100
parent 740:1861d6ba6ff6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
740
1861d6ba6ff6 mod_http_favicon: Add, serves a favicon.ico
Kim Alvefur <zash@zash.se>
parents:
diff changeset
1 module:depends("http");
1861d6ba6ff6 mod_http_favicon: Add, serves a favicon.ico
Kim Alvefur <zash@zash.se>
parents:
diff changeset
2
1861d6ba6ff6 mod_http_favicon: Add, serves a favicon.ico
Kim Alvefur <zash@zash.se>
parents:
diff changeset
3 local favicon = require"util.encodings".base64.decode[[
1861d6ba6ff6 mod_http_favicon: Add, serves a favicon.ico
Kim Alvefur <zash@zash.se>
parents:
diff changeset
4 AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAQAAAAAAAAAAAAAAAAA
1861d6ba6ff6 mod_http_favicon: Add, serves a favicon.ico
Kim Alvefur <zash@zash.se>
parents:
diff changeset
5 AAAAAAD///8AsuD6TGrE95RiwfabYsH2m2TB9pmU1Phq+vz9A/38+wPx07xq67+emeq+nZvqvp2b
1861d6ba6ff6 mod_http_favicon: Add, serves a favicon.ico
Kim Alvefur <zash@zash.se>
parents:
diff changeset
6 68GilPTfz0z///8AsuD6TACb8v8Am/L/AJvy/wCb8v8Am/L/AJvy/3TI94ntxqiJ35dh/9+XYf/f
1861d6ba6ff6 mod_http_favicon: Add, serves a favicon.ico
Kim Alvefur <zash@zash.se>
parents:
diff changeset
7 l2H/35dh/9+XYf/fl2H/9N/PTGrE95QAm/L/AJvy/wCb8v8Am/L/AJvy/wCb8v8qq/PU5Kh61N+X
1861d6ba6ff6 mod_http_favicon: Add, serves a favicon.ico
Kim Alvefur <zash@zash.se>
parents:
diff changeset
8 Yf/fl2H/35dh/9+XYf/fl2H/35dh/+vBopRiwfabAJvy/wCb8v8Am/L/AJvy/wCb8v8Am/L/Iqjz
1861d6ba6ff6 mod_http_favicon: Add, serves a favicon.ico
Kim Alvefur <zash@zash.se>
parents:
diff changeset
9 3OOkdtzfl2H/35dh/9+XYf/fl2H/35dh/9+XYf/qvp2bYsH2mwCb8v8Am/L/AJvy/wCb8v8Am/L/
1861d6ba6ff6 mod_http_favicon: Add, serves a favicon.ico
Kim Alvefur <zash@zash.se>
parents:
diff changeset
10 AJvy/yKo89zjpHbc35dh/9+XYf/fl2H/35dh/9+XYf/fl2H/6r6dm2TB9pkAm/L/AJvy/wCb8v8A
1861d6ba6ff6 mod_http_favicon: Add, serves a favicon.ico
Kim Alvefur <zash@zash.se>
parents:
diff changeset
11 m/L/AJvy/wCb8v8kqfPa46V32t+XYf/fl2H/35dh/9+XYf/fl2H/35dh/+u/npmU1PhqAJvy/wCb
1861d6ba6ff6 mod_http_favicon: Add, serves a favicon.ico
Kim Alvefur <zash@zash.se>
parents:
diff changeset
12 8v8Am/L/AJvy/wCb8v8Am/L/Vrz2p+m5lqffl2H/35dh/9+XYf/fl2H/35dh/9+XYf/x07xq+vz9
1861d6ba6ff6 mod_http_favicon: Add, serves a favicon.ico
Kim Alvefur <zash@zash.se>
parents:
diff changeset
13 A3TI94kqq/PUIqjz3CKo89wkqfPaVrz2p+b0/Bf79O8X6bmWp+Old9rjpHbc46R23OSoetTtxqiJ
1861d6ba6ff6 mod_http_favicon: Add, serves a favicon.ico
Kim Alvefur <zash@zash.se>
parents:
diff changeset
14 /fz7A/38+wPtxqiJ5Kh61OOkdtzjpHbc46V32um5lqf79O8X5vT8F1a89qckqfPaIqjz3CKo89wq
1861d6ba6ff6 mod_http_favicon: Add, serves a favicon.ico
Kim Alvefur <zash@zash.se>
parents:
diff changeset
15 q/PUdMj3ifr8/QPx07xq35dh/9+XYf/fl2H/35dh/9+XYf/fl2H/6bmWp1a89qcAm/L/AJvy/wCb
1861d6ba6ff6 mod_http_favicon: Add, serves a favicon.ico
Kim Alvefur <zash@zash.se>
parents:
diff changeset
16 8v8Am/L/AJvy/wCb8v+U1Phq67+emd+XYf/fl2H/35dh/9+XYf/fl2H/35dh/+Old9okqfPaAJvy
1861d6ba6ff6 mod_http_favicon: Add, serves a favicon.ico
Kim Alvefur <zash@zash.se>
parents:
diff changeset
17 /wCb8v8Am/L/AJvy/wCb8v8Am/L/ZMH2meq+nZvfl2H/35dh/9+XYf/fl2H/35dh/9+XYf/jpHbc
1861d6ba6ff6 mod_http_favicon: Add, serves a favicon.ico
Kim Alvefur <zash@zash.se>
parents:
diff changeset
18 Iqjz3ACb8v8Am/L/AJvy/wCb8v8Am/L/AJvy/2LB9pvqvp2b35dh/9+XYf/fl2H/35dh/9+XYf/f
1861d6ba6ff6 mod_http_favicon: Add, serves a favicon.ico
Kim Alvefur <zash@zash.se>
parents:
diff changeset
19 l2H/46R23CKo89wAm/L/AJvy/wCb8v8Am/L/AJvy/wCb8v9iwfab68GilN+XYf/fl2H/35dh/9+X
1861d6ba6ff6 mod_http_favicon: Add, serves a favicon.ico
Kim Alvefur <zash@zash.se>
parents:
diff changeset
20 Yf/fl2H/35dh/+SoetQqq/PUAJvy/wCb8v8Am/L/AJvy/wCb8v8Am/L/asT3lPTfz0zfl2H/35dh
1861d6ba6ff6 mod_http_favicon: Add, serves a favicon.ico
Kim Alvefur <zash@zash.se>
parents:
diff changeset
21 /9+XYf/fl2H/35dh/9+XYf/txqiJdMj3iQCb8v8Am/L/AJvy/wCb8v8Am/L/AJvy/7Lg+kz///8A
1861d6ba6ff6 mod_http_favicon: Add, serves a favicon.ico
Kim Alvefur <zash@zash.se>
parents:
diff changeset
22 9N/PTOvBopTqvp2b6r6dm+u/npnx07xq/fz7A/r8/QOU1PhqZMH2mWLB9ptiwfabasT3lLLg+kz/
1861d6ba6ff6 mod_http_favicon: Add, serves a favicon.ico
Kim Alvefur <zash@zash.se>
parents:
diff changeset
23 //8Aw8MAAIABAAAAAAAAAAAAAAAAAAAAAAAAgAEAAIGBAACBgQAAgAEAAAAAAAAAAAAAAAAAAAAA
1861d6ba6ff6 mod_http_favicon: Add, serves a favicon.ico
Kim Alvefur <zash@zash.se>
parents:
diff changeset
24 AACAAQAAw8MAAA==]];
1861d6ba6ff6 mod_http_favicon: Add, serves a favicon.ico
Kim Alvefur <zash@zash.se>
parents:
diff changeset
25
1861d6ba6ff6 mod_http_favicon: Add, serves a favicon.ico
Kim Alvefur <zash@zash.se>
parents:
diff changeset
26 local filename = module:get_option_string("favicon");
1861d6ba6ff6 mod_http_favicon: Add, serves a favicon.ico
Kim Alvefur <zash@zash.se>
parents:
diff changeset
27 if filename then
1861d6ba6ff6 mod_http_favicon: Add, serves a favicon.ico
Kim Alvefur <zash@zash.se>
parents:
diff changeset
28 local fd = assert(module:load_resource(filename));
1861d6ba6ff6 mod_http_favicon: Add, serves a favicon.ico
Kim Alvefur <zash@zash.se>
parents:
diff changeset
29 favicon = assert(fd:read("*a"));
1861d6ba6ff6 mod_http_favicon: Add, serves a favicon.ico
Kim Alvefur <zash@zash.se>
parents:
diff changeset
30 end
1861d6ba6ff6 mod_http_favicon: Add, serves a favicon.ico
Kim Alvefur <zash@zash.se>
parents:
diff changeset
31
1861d6ba6ff6 mod_http_favicon: Add, serves a favicon.ico
Kim Alvefur <zash@zash.se>
parents:
diff changeset
32 module:provides("http", {
1861d6ba6ff6 mod_http_favicon: Add, serves a favicon.ico
Kim Alvefur <zash@zash.se>
parents:
diff changeset
33 default_path = "/favicon.ico";
1861d6ba6ff6 mod_http_favicon: Add, serves a favicon.ico
Kim Alvefur <zash@zash.se>
parents:
diff changeset
34 route = {
1861d6ba6ff6 mod_http_favicon: Add, serves a favicon.ico
Kim Alvefur <zash@zash.se>
parents:
diff changeset
35 GET = {
1861d6ba6ff6 mod_http_favicon: Add, serves a favicon.ico
Kim Alvefur <zash@zash.se>
parents:
diff changeset
36 headers = {
1861d6ba6ff6 mod_http_favicon: Add, serves a favicon.ico
Kim Alvefur <zash@zash.se>
parents:
diff changeset
37 content_type = "image/x-icon";
1861d6ba6ff6 mod_http_favicon: Add, serves a favicon.ico
Kim Alvefur <zash@zash.se>
parents:
diff changeset
38 };
1861d6ba6ff6 mod_http_favicon: Add, serves a favicon.ico
Kim Alvefur <zash@zash.se>
parents:
diff changeset
39 body = favicon;
1861d6ba6ff6 mod_http_favicon: Add, serves a favicon.ico
Kim Alvefur <zash@zash.se>
parents:
diff changeset
40 }
1861d6ba6ff6 mod_http_favicon: Add, serves a favicon.ico
Kim Alvefur <zash@zash.se>
parents:
diff changeset
41 }
1861d6ba6ff6 mod_http_favicon: Add, serves a favicon.ico
Kim Alvefur <zash@zash.se>
parents:
diff changeset
42 });