comparison mod_sasl2/mod_sasl2.lua @ 5023:90772a9c92a0

mod_sasl2: Include additional-data in SASL success response
author Matthew Wild <mwild1@gmail.com>
date Sun, 28 Aug 2022 15:03:58 +0100
parents f62b091b1c81
children fd154db7c8fc
comparison
equal deleted inserted replaced
5022:97d34d520cfa 5023:90772a9c92a0
92 if not ok then 92 if not ok then
93 handle_status(session, "failure", err); 93 handle_status(session, "failure", err);
94 return true; 94 return true;
95 end 95 end
96 event.success = st.stanza("success", { xmlns = xmlns_sasl2 }); 96 event.success = st.stanza("success", { xmlns = xmlns_sasl2 });
97 if event.message then
98 event.success:text_tag("additional-data", base64.encode(event.message));
99 end
97 end, 1000); 100 end, 1000);
98 101
99 module:hook("sasl2/c2s/success", function (event) 102 module:hook("sasl2/c2s/success", function (event)
100 local session = event.session 103 local session = event.session
101 event.success:text_tag("authorization-identifier", jid_join(session.username, session.host, session.resource)); 104 event.success:text_tag("authorization-identifier", jid_join(session.username, session.host, session.resource));