blob: 5ba90190eaff7a5072f7d0f1d6f97fe4b973cb53 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
local saslprep = require "util.encodings".stringprep.saslprep;
local _ENV = nil;
local function external(self, message)
message = saslprep(message);
local state
self.username, state = self.profile.external(message);
if state == false then
return "failure", "account-disabled";
elseif state == nil then
return "failure", "not-authorized";
elseif state == "expired" then
return "false", "credentials-expired";
end
return "success";
end
local function init(registerMechanism)
registerMechanism("EXTERNAL", {"external"}, external);
end
return {
init = init;
}
|