Comparison

plugins/mod_auth_internal_hashed.lua @ 12946:59478b295137

mod_auth_internal_hashed: Shorten call path Why did it call a function defined in the same module through usermanager?
author Kim Alvefur <zash@zash.se>
date Sat, 18 Mar 2023 16:13:32 +0100
parent 12933:3ab0bbb1dc35
child 12977:74b9e05af71e
comparison
equal deleted inserted replaced
12945:d2c1c327a4d1 12946:59478b295137
8 -- 8 --
9 9
10 local max = math.max; 10 local max = math.max;
11 11
12 local scram_hashers = require "util.sasl.scram".hashers; 12 local scram_hashers = require "util.sasl.scram".hashers;
13 local usermanager = require "core.usermanager";
14 local generate_uuid = require "util.uuid".generate; 13 local generate_uuid = require "util.uuid".generate;
15 local new_sasl = require "util.sasl".new; 14 local new_sasl = require "util.sasl".new;
16 local hex = require"util.hex"; 15 local hex = require"util.hex";
17 local to_hex, from_hex = hex.encode, hex.decode; 16 local to_hex, from_hex = hex.encode, hex.decode;
18 local saslprep = require "util.encodings".stringprep.saslprep; 17 local saslprep = require "util.encodings".stringprep.saslprep;
161 return accounts:set(username, nil); 160 return accounts:set(username, nil);
162 end 161 end
163 162
164 function provider.get_sasl_handler() 163 function provider.get_sasl_handler()
165 local testpass_authentication_profile = { 164 local testpass_authentication_profile = {
166 plain_test = function(_, username, password, realm) 165 plain_test = function(_, username, password)
167 return usermanager.test_password(username, realm, password), provider.is_enabled(username); 166 return provider.test_password(username, password), provider.is_enabled(username);
168 end, 167 end,
169 [scram_name] = function(_, username) 168 [scram_name] = function(_, username)
170 local credentials = accounts:get(username); 169 local credentials = accounts:get(username);
171 if not credentials then return; end 170 if not credentials then return; end
172 if credentials.password then 171 if credentials.password then