136 end |
136 end |
137 |
137 |
138 function provider.get_sasl_handler() |
138 function provider.get_sasl_handler() |
139 local realm = module:get_option("sasl_realm") or module.host; |
139 local realm = module:get_option("sasl_realm") or module.host; |
140 local testpass_authentication_profile = { |
140 local testpass_authentication_profile = { |
141 plain_test = function(username, password, realm) |
141 plain_test = function(sasl, username, password, realm) |
142 local prepped_username = nodeprep(username); |
142 local prepped_username = nodeprep(username); |
143 if not prepped_username then |
143 if not prepped_username then |
144 log("debug", "NODEprep failed on username: %s", username); |
144 log("debug", "NODEprep failed on username: %s", username); |
145 return "", nil; |
145 return "", nil; |
146 end |
146 end |
147 return usermanager.test_password(prepped_username, realm, password), true; |
147 return usermanager.test_password(prepped_username, realm, password), true; |
148 end, |
148 end, |
149 scram_sha_1 = function(username, realm) |
149 scram_sha_1 = function(sasl, username, realm) |
150 local credentials = datamanager.load(username, host, "accounts"); |
150 local credentials = datamanager.load(username, host, "accounts"); |
151 if not credentials then return; end |
151 if not credentials then return; end |
152 if credentials.password then |
152 if credentials.password then |
153 usermanager.set_password(username, credentials.password, host); |
153 usermanager.set_password(username, credentials.password, host); |
154 credentials = datamanager.load(username, host, "accounts"); |
154 credentials = datamanager.load(username, host, "accounts"); |