Changeset

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 5000:8b6fe33d1c9b
children 5002:84997bc3f92e
files mod_rest/mod_rest.lua
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mod_rest/mod_rest.lua	Wed Jul 13 11:23:55 2022 +0100
+++ b/mod_rest/mod_rest.lua	Wed Jul 13 11:27:44 2022 +0100
@@ -49,11 +49,15 @@
 		end
 		return { username = username, host = module.host };
 	elseif auth_type == "Bearer" then
-		local token_info = tokens.get_token_info(auth_data);
-		if not token_info or not token_info.session then
-			return false;
+		if tokens.get_token_session then
+			return tokens.get_token_session(auth_data);
+		else -- COMPAT w/0.12
+			local token_info = tokens.get_token_info(auth_data);
+			if not token_info or not token_info.session then
+				return false;
+			end
+			return token_info.session;
 		end
-		return token_info.session;
 	end
 	return nil;
 end