From fff93961ee3c172043640187e031c6d04a182137 Mon Sep 17 00:00:00 2001 From: I515719 Date: Mon, 26 Jan 2026 12:45:13 +0800 Subject: [PATCH] chore: fix api rejected unauthorized request --- src/pyinfraboxutils/ibflask.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pyinfraboxutils/ibflask.py b/src/pyinfraboxutils/ibflask.py index 06c59cf6..ca675de5 100644 --- a/src/pyinfraboxutils/ibflask.py +++ b/src/pyinfraboxutils/ibflask.py @@ -142,11 +142,12 @@ def check_request_authorization(): is_authorized = opa_do_auth(opa_input) if not is_authorized: - logger.info("Rejected unauthorized request") + logger.info("Rejected unauthorized request: path=%s, method=%s, token_type=%s", + request.path, request.method, g.token.get('type') if g.token else 'None') abort(401, 'Unauthorized') except requests.exceptions.RequestException as e: - logger.error(e) + logger.error("OPA Authorization service error: %s. Check if OPA is running at configured host/port", e) abort(500, 'Authorization failed') def check_job_belongs_to_project(f):