Software /
code /
prosody-modules
File
mod_sasl_ssdp/mod_sasl_ssdp.lua @ 5931:d194d1012fd3
Updating dox for mod_rest. Ideas expressed / clarified:
1) Making clear that mod_rest isn't to be installed under VirtualHosts AND as a component.
2) Understanding some of the implications of this choice:
A) Changes to user authentication
B) How it affects subdomains
3) More consistent use of domain names for clarity.
4) Using different heading sizes to show scope of section.
Essentially, I added all the tidbits I had to clarify in getting this to work in my
own example.
author | Ben Smith <bens@effortlessis.com> |
---|---|
date | Mon, 13 May 2024 13:25:13 -0700 |
parent | 5842:bb51cf204dd4 |
line wrap: on
line source
local array = require "util.array"; local hashes = require "util.hashes"; local it = require "util.iterators"; local base64_enc = require "util.encodings".base64.encode; local hash_functions = { ["SCRAM-SHA-1"] = hashes.sha1; ["SCRAM-SHA-1-PLUS"] = hashes.sha1; ["SCRAM-SHA-256"] = hashes.sha256; ["SCRAM-SHA-256-PLUS"] = hashes.sha256; }; function add_ssdp_info(event) local sasl_handler = event.session.sasl_handler; local hash = hash_functions[sasl_handler.selected]; if not hash then module:log("debug", "Not enabling SSDP for unsupported mechanism: %s", sasl_handler.selected); return; end local mechanism_list = array.collect(it.keys(sasl_handler:mechanisms())):sort(); local cb = sasl_handler.profile.cb; local cb_list = cb and array.collect(it.keys(cb)):sort(); local ssdp_string; if cb_list then ssdp_string = mechanism_list:concat(",").."|"..cb_list:concat(","); else ssdp_string = mechanism_list:concat(","); end module:log("debug", "Calculated SSDP string: %s", ssdp_string); event.message = event.message..",d="..base64_enc(hash(ssdp_string)); sasl_handler.state.server_first_message = event.message; end module:hook("sasl/c2s/challenge", add_ssdp_info, 1); module:hook("sasl2/c2s/challenge", add_ssdp_info, 1);