comparison mod_rest/mod_rest.lua @ 5001:cb19cb1c03d6

mod_rest: Update for mod_tokenauth API changes (backwards-compatible)
author Matthew Wild <mwild1@gmail.com>
date Wed, 13 Jul 2022 11:27:44 +0100
parents 732229fe68ab
children dec4b2e31d1c
comparison
equal deleted inserted replaced
5000:8b6fe33d1c9b 5001:cb19cb1c03d6
47 if not um.test_password(username, module.host, password) then 47 if not um.test_password(username, module.host, password) then
48 return false; 48 return false;
49 end 49 end
50 return { username = username, host = module.host }; 50 return { username = username, host = module.host };
51 elseif auth_type == "Bearer" then 51 elseif auth_type == "Bearer" then
52 local token_info = tokens.get_token_info(auth_data); 52 if tokens.get_token_session then
53 if not token_info or not token_info.session then 53 return tokens.get_token_session(auth_data);
54 return false; 54 else -- COMPAT w/0.12
55 end 55 local token_info = tokens.get_token_info(auth_data);
56 return token_info.session; 56 if not token_info or not token_info.session then
57 return false;
58 end
59 return token_info.session;
60 end
57 end 61 end
58 return nil; 62 return nil;
59 end 63 end
60 64
61 if module:get_option_string("authentication") == "anonymous" and module:get_option_boolean("anonymous_rest") then 65 if module:get_option_string("authentication") == "anonymous" and module:get_option_boolean("anonymous_rest") then