Software /
code /
verse
Comparison
plugins/sasl.lua @ 456:6a65142052c8
sasl: Include offered mechanisms in event when no supported mechanisms found
This allows consumers of the event to determine what may be required in order
to successfully authenticate.
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 03 Mar 2023 12:10:54 +0000 |
parent | 395:e86144a4eaa1 |
child | 467:8e6a7a5e70b3 |
comparison
equal
deleted
inserted
replaced
455:753d6983dc45 | 456:6a65142052c8 |
---|---|
30 local supported = {}; -- by the server | 30 local supported = {}; -- by the server |
31 for mech in pairs(mechanisms) do | 31 for mech in pairs(mechanisms) do |
32 table.insert(supported, mech); | 32 table.insert(supported, mech); |
33 end | 33 end |
34 if not supported[1] then | 34 if not supported[1] then |
35 stream:event("authentication-failure", { condition = "no-supported-sasl-mechanisms" }); | 35 stream:event("authentication-failure", { condition = "no-supported-sasl-mechanisms", mechanisms = mechanisms }); |
36 stream:close(); | 36 stream:close(); |
37 return; | 37 return; |
38 end | 38 end |
39 table.sort(supported, function (a, b) return preference[a] > preference[b]; end); | 39 table.sort(supported, function (a, b) return preference[a] > preference[b]; end); |
40 local mechanism, initial_data = supported[1]; | 40 local mechanism, initial_data = supported[1]; |