changeset 5336:77ac04bd2f65

mod_http_oauth2: Add some debug logging for UserInfo endpoint
author Kim Alvefur <zash@zash.se>
date Mon, 10 Apr 2023 10:47:51 +0200
parents 53c6f49dcbb8
children 8d8e85d6dc91
files mod_http_oauth2/mod_http_oauth2.lua
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_http_oauth2/mod_http_oauth2.lua	Mon Apr 10 10:44:23 2023 +0200
+++ b/mod_http_oauth2/mod_http_oauth2.lua	Mon Apr 10 10:47:51 2023 +0200
@@ -750,10 +750,12 @@
 	local request = event.request;
 	local credentials = get_request_credentials(request);
 	if not credentials or not credentials.bearer_token then
+		module:log("debug", "Missing credentials for UserInfo endpoint: %q", credentials)
 		return 401;
 	end
-	local token_info = tokens.get_token_info(credentials.bearer_token);
+	local token_info,err = tokens.get_token_info(credentials.bearer_token);
 	if not token_info then
+		module:log("debug", "UserInfo query failed token validation: %s", err)
 		return 403;
 	end
 	-- TODO check that they actually have access to the userinfo endpoint, aka