aboutsummaryrefslogtreecommitdiffstats
path: root/util/sasl
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2013-06-29 14:45:47 +0100
committerMatthew Wild <mwild1@gmail.com>2013-06-29 14:45:47 +0100
commit1ff17bd2f363d64e96b5f55c40da0768eb2931a0 (patch)
tree27741db74d498be76001287c8a4e6a9076bb5a27 /util/sasl
parentd9d3fda27d4cbd522bbf2b53bb22c7659020a0c7 (diff)
parent237fbdb8e53b39063c1df36d94f59695d80c2de2 (diff)
downloadprosody-1ff17bd2f363d64e96b5f55c40da0768eb2931a0.tar.gz
prosody-1ff17bd2f363d64e96b5f55c40da0768eb2931a0.zip
Merge
Diffstat (limited to 'util/sasl')
-rw-r--r--util/sasl/external.lua25
1 files changed, 25 insertions, 0 deletions
diff --git a/util/sasl/external.lua b/util/sasl/external.lua
new file mode 100644
index 00000000..4c5c4343
--- /dev/null
+++ b/util/sasl/external.lua
@@ -0,0 +1,25 @@
+local saslprep = require "util.encodings".stringprep.saslprep;
+
+module "sasl.external"
+
+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
+
+function init(registerMechanism)
+ registerMechanism("EXTERNAL", {"external"}, external);
+end
+
+return _M;