Changeset

12952:a668bc1aa39d

mod_tokenauth: Log error when token validation fails
author Matthew Wild <mwild1@gmail.com>
date Tue, 21 Mar 2023 14:04:39 +0000
parents 12951:4cc0785f960e
children 12953:ebe3b2f96cad
files plugins/mod_tokenauth.lua
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_tokenauth.lua	Tue Mar 21 14:01:03 2023 +0000
+++ b/plugins/mod_tokenauth.lua	Tue Mar 21 14:04:39 2023 +0000
@@ -89,6 +89,7 @@
 function get_token_info(token)
 	local token_id, token_user, token_host = parse_token(token);
 	if not token_id then
+		module:log("warn", "Failed to verify access token: %s", token_user);
 		return nil, "invalid-token-format";
 	end
 	return _get_parsed_token_info(token_id, token_user, token_host);
@@ -97,6 +98,7 @@
 function get_token_session(token, resource)
 	local token_id, token_user, token_host = parse_token(token);
 	if not token_id then
+		module:log("warn", "Failed to verify access token: %s", token_user);
 		return nil, "invalid-token-format";
 	end
 
@@ -116,6 +118,7 @@
 function revoke_token(token)
 	local token_id, token_user, token_host = parse_token(token);
 	if not token_id then
+		module:log("warn", "Failed to verify access token: %s", token_user);
 		return nil, "invalid-token-format";
 	end
 	if token_host ~= module.host then