From 5fef84a1801d03f395853a28b687f5634b7b25db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Dugovi=C4=8D?= Date: Fri, 16 Aug 2024 11:07:22 +0200 Subject: [PATCH] RHINENG-11685: add debug logs --- manager/middlewares/rbac.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/manager/middlewares/rbac.go b/manager/middlewares/rbac.go index a7bde75aa..014fdeead 100644 --- a/manager/middlewares/rbac.go +++ b/manager/middlewares/rbac.go @@ -104,6 +104,10 @@ func isAccessGranted(c *gin.Context) bool { client := makeClient(c.GetHeader("x-rh-identity")) access := rbac.AccessPagination{} res, err := client.Request(&base.Context, http.MethodGet, rbacURL, nil, &access) + utils.LogDebug("response_headers", res.Header, "request_headers", res.Request.Header, "isAccessGranted rbac") + if c.Request != nil { + utils.LogDebug("gin_context_req", *c.Request, "isAccessGranted rbac") + } if res != nil && res.Body != nil { defer res.Body.Close() } @@ -195,6 +199,9 @@ func RBAC() gin.HandlerFunc { if isAccessGranted(c) { return } + if c.Request != nil { + utils.LogDebug("context_req", c.Request, "RBAC") + } c.AbortWithStatusJSON(http.StatusUnauthorized, utils.ErrorResponse{Error: "You don't have access to this application"}) }