From 36039a2209a740d751a8106fe779cfe530c6d21d 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 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/manager/middlewares/rbac.go b/manager/middlewares/rbac.go index a7bde75aa..31f8105b6 100644 --- a/manager/middlewares/rbac.go +++ b/manager/middlewares/rbac.go @@ -104,6 +104,12 @@ 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) + if res != nil { + 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 +201,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"}) }