Software /
code /
prosody
Comparison
plugins/mod_auth_cyrus.lua @ 5115:3939960b3c07
mod_auth_{internal_plain,cyrus,anonymous}: Get rid of useless wrapper function new_default_provider.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Wed, 12 Sep 2012 21:32:12 +0500 |
parent | 5000:58c9519dc461 |
child | 5117:2c7e1ce8f482 |
comparison
equal
deleted
inserted
replaced
5113:3393cab2dd6b | 5115:3939960b3c07 |
---|---|
39 else | 39 else |
40 module:log("debug", "Available Cyrus SASL mechanisms: %s", list); | 40 module:log("debug", "Available Cyrus SASL mechanisms: %s", list); |
41 end | 41 end |
42 end | 42 end |
43 | 43 |
44 function new_default_provider(host) | 44 local host = module.host; |
45 local provider = { name = "cyrus" }; | |
46 log("debug", "initializing default authentication provider for host '%s'", host); | |
47 | 45 |
48 function provider.test_password(username, password) | 46 -- define auth provider |
49 return nil, "Legacy auth not supported with Cyrus SASL."; | 47 local provider = { name = "cyrus" }; |
50 end | 48 log("debug", "initializing default authentication provider for host '%s'", host); |
51 | 49 |
52 function provider.get_password(username) | 50 function provider.test_password(username, password) |
53 return nil, "Passwords unavailable for Cyrus SASL."; | 51 return nil, "Legacy auth not supported with Cyrus SASL."; |
54 end | |
55 | |
56 function provider.set_password(username, password) | |
57 return nil, "Passwords unavailable for Cyrus SASL."; | |
58 end | |
59 | |
60 function provider.user_exists(username) | |
61 if require_provisioning then | |
62 return usermanager_user_exists(username, module.host); | |
63 end | |
64 return true; | |
65 end | |
66 | |
67 function provider.create_user(username, password) | |
68 return nil, "Account creation/modification not available with Cyrus SASL."; | |
69 end | |
70 | |
71 function provider.get_sasl_handler() | |
72 local handler = new_sasl(module.host); | |
73 if require_provisioning then | |
74 function handler.require_provisioning(username) | |
75 return usermanager_user_exists(username, module.host); | |
76 end | |
77 end | |
78 return handler; | |
79 end | |
80 | |
81 return provider; | |
82 end | 52 end |
83 | 53 |
84 module:add_item("auth-provider", new_default_provider(module.host)); | 54 function provider.get_password(username) |
55 return nil, "Passwords unavailable for Cyrus SASL."; | |
56 end | |
85 | 57 |
58 function provider.set_password(username, password) | |
59 return nil, "Passwords unavailable for Cyrus SASL."; | |
60 end | |
61 | |
62 function provider.user_exists(username) | |
63 if require_provisioning then | |
64 return usermanager_user_exists(username, host); | |
65 end | |
66 return true; | |
67 end | |
68 | |
69 function provider.create_user(username, password) | |
70 return nil, "Account creation/modification not available with Cyrus SASL."; | |
71 end | |
72 | |
73 function provider.get_sasl_handler() | |
74 local handler = new_sasl(host); | |
75 if require_provisioning then | |
76 function handler.require_provisioning(username) | |
77 return usermanager_user_exists(username, host); | |
78 end | |
79 end | |
80 return handler; | |
81 end | |
82 | |
83 module:add_item("auth-provider", provider); | |
84 |