Software / code / prosody
Comparison
util/sasl.lua @ 2177:8505e1da5408 sasl
Adding some docu.
| author | Tobias Markmann <tm@ayena.de> |
|---|---|
| date | Sun, 16 Aug 2009 23:20:02 +0200 |
| parent | 2176:aaf2b2df61f7 |
| child | 2178:28d841403a21 |
comparison
equal
deleted
inserted
replaced
| 2176:aaf2b2df61f7 | 2177:8505e1da5408 |
|---|---|
| 35 local keys = keys | 35 local keys = keys |
| 36 | 36 |
| 37 local array = require "util.array" | 37 local array = require "util.array" |
| 38 module "sasl" | 38 module "sasl" |
| 39 | 39 |
| 40 --[[ | |
| 41 Authentication Backend Prototypes: | |
| 42 | |
| 43 plain: | |
| 44 function(username, realm) | |
| 45 return password, state; | |
| 46 end | |
| 47 | |
| 48 plain-test: | |
| 49 function(username, realm, password) | |
| 50 return true or false, state; | |
| 51 end | |
| 52 | |
| 53 digest-md5: | |
| 54 function(username, realm, encoding) | |
| 55 return digesthash, state; | |
| 56 end | |
| 57 | |
| 58 digest-md5-test: | |
| 59 function(username, realm, encoding, digesthash) | |
| 60 return true or false, state; | |
| 61 end | |
| 62 ]] | |
| 63 | |
| 40 local method = {}; | 64 local method = {}; |
| 41 method.__index = method; | 65 method.__index = method; |
| 42 local mechanisms = {}; | 66 local mechanisms = {}; |
| 43 local backend_mechanism = {}; | 67 local backend_mechanism = {}; |
| 44 | 68 |
| 69 for _, mechanism in ipairs(backend_mechanism[backend]) do | 93 for _, mechanism in ipairs(backend_mechanism[backend]) do |
| 70 mechanisms[mechanism] = true; | 94 mechanisms[mechanism] = true; |
| 71 end | 95 end |
| 72 end | 96 end |
| 73 end | 97 end |
| 98 self["possible_mechanisms"] = mechanisms; | |
| 74 return array.collect(keys(mechanisms)); | 99 return array.collect(keys(mechanisms)); |
| 75 end | 100 end |
| 76 | 101 |
| 77 -- select a mechanism to use | 102 -- select a mechanism to use |
| 78 function method:select(mechanism) | 103 function method:select(mechanism) |