Comparison

util/sasl/external.lua @ 5695:460070c84eae

Merge the merge
author Matthew Wild <mwild1@gmail.com>
date Thu, 13 Jun 2013 23:24:36 +0100
parent 5687:e879b53e9df8
child 6777:5de6b93d0190
comparison
equal deleted inserted replaced
5694:7aec065d78a0 5695:460070c84eae
1 local saslprep = require "util.encodings".stringprep.saslprep;
2
3 module "sasl.external"
4
5 local function external(self, message)
6 message = saslprep(message);
7 local state
8 self.username, state = self.profile.external(message);
9
10 if state == false then
11 return "failure", "account-disabled";
12 elseif state == nil then
13 return "failure", "not-authorized";
14 elseif state == "expired" then
15 return "false", "credentials-expired";
16 end
17
18 return "success";
19 end
20
21 function init(registerMechanism)
22 registerMechanism("EXTERNAL", {"external"}, external);
23 end
24
25 return _M;