comparison mod_auth_internal_yubikey/mod_auth_internal_yubikey.lua @ 902:490cb9161c81

mod_auth_{external,internal_yubikey,ldap,ldap2,sql}: No need to nodeprep in SASL handler.
author Waqas Hussain <waqas20@gmail.com>
date Sat, 26 Jan 2013 04:34:05 +0500
parents 960007b0901e
children 7dbde05b48a9
comparison
equal deleted inserted replaced
901:e3ad5f3aa6d4 902:490cb9161c81
16 local jid = require "util.jid"; 16 local jid = require "util.jid";
17 local jid_bare = require "util.jid".bare; 17 local jid_bare = require "util.jid".bare;
18 local config = require "core.configmanager"; 18 local config = require "core.configmanager";
19 local usermanager = require "core.usermanager"; 19 local usermanager = require "core.usermanager";
20 local new_sasl = require "util.sasl".new; 20 local new_sasl = require "util.sasl".new;
21 local nodeprep = require "util.encodings".stringprep.nodeprep;
22 local hosts = hosts; 21 local hosts = hosts;
23 22
24 local prosody = _G.prosody; 23 local prosody = _G.prosody;
25 24
26 local yubikey = require "yubikey".new_authenticator({ 25 local yubikey = require "yubikey".new_authenticator({
104 103
105 function provider.get_sasl_handler() 104 function provider.get_sasl_handler()
106 local realm = module:get_option("sasl_realm") or module.host; 105 local realm = module:get_option("sasl_realm") or module.host;
107 local getpass_authentication_profile = { 106 local getpass_authentication_profile = {
108 plain_test = function(sasl, username, password, realm) 107 plain_test = function(sasl, username, password, realm)
109 local prepped_username = nodeprep(username);
110 if not prepped_username then
111 log("debug", "NODEprep failed on username: %s", username);
112 return false, nil;
113 end
114
115 return usermanager.test_password(username, realm, password), true; 108 return usermanager.test_password(username, realm, password), true;
116 end 109 end
117 }; 110 };
118 return new_sasl(realm, getpass_authentication_profile); 111 return new_sasl(realm, getpass_authentication_profile);
119 end 112 end