Comparison

mod_auth_oauth_external/mod_auth_oauth_external.lua @ 5856:75dee6127829 draft

Merge upstream
author Trần H. Trung <xmpp:trần.h.trung@trung.fun>
date Tue, 06 Feb 2024 18:32:01 +0700
parent 5753:6592c444e85c
comparison
equal deleted inserted replaced
5664:52db2da66680 5856:75dee6127829
32 32
33 local function not_implemented() 33 local function not_implemented()
34 return nil, "method not implemented" 34 return nil, "method not implemented"
35 end 35 end
36 36
37 -- With proper OAuth 2, most of these should be handled at the atuhorization 37 -- With proper OAuth 2, most of these should be handled at the authorization
38 -- server, no there. 38 -- server, no there.
39 provider.test_password = not_implemented; 39 provider.test_password = not_implemented;
40 provider.get_password = not_implemented; 40 provider.get_password = not_implemented;
41 provider.set_password = not_implemented; 41 provider.set_password = not_implemented;
42 provider.create_user = not_implemented; 42 provider.create_user = not_implemented;
56 end 56 end
57 end 57 end
58 58
59 function provider.get_sasl_handler() 59 function provider.get_sasl_handler()
60 local profile = {}; 60 local profile = {};
61 profile.http_client = http.default; -- TODO configurable 61 profile.http_client = http.new({ connection_pooling = true }); -- TODO configurable
62 local extra = { oidc_discovery_url = oidc_discovery_url }; 62 local extra = { oidc_discovery_url = oidc_discovery_url };
63 if token_endpoint and allow_plain then 63 if token_endpoint and allow_plain then
64 local map_username = function (username, _realm) return username; end; --jid.join; -- TODO configurable 64 local map_username = function (username, _realm) return username; end; --jid.join; -- TODO configurable
65 function profile:plain_test(username, password, realm) 65 function profile:plain_test(username, password, realm)
66 username = jid.unescape(username); -- COMPAT Mastodon 66 username = jid.unescape(username); -- COMPAT Mastodon