From c15ecf9979789c2718c954c5523563d4f0dd5a3d Mon Sep 17 00:00:00 2001 From: Rushikesh Tote <31135699+rushitote@users.noreply.github.com> Date: Tue, 3 Aug 2021 13:45:30 +0530 Subject: [PATCH] Update apisix/plugins/authz-casbin.lua Co-authored-by: tzssangglass --- apisix/plugins/authz-casbin.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apisix/plugins/authz-casbin.lua b/apisix/plugins/authz-casbin.lua index 0f74180a61c6..163acb3d1e47 100644 --- a/apisix/plugins/authz-casbin.lua +++ b/apisix/plugins/authz-casbin.lua @@ -106,8 +106,7 @@ function _M.rewrite(conf, ctx) local path = ctx.var.uri local method = ctx.var.method - local username = get_headers()[conf.username] - if not username then username = "anonymous" end + local username = get_headers()[conf.username] or "anonymous" if conf.casbin_enforcer then if not conf.casbin_enforcer:enforce(username, path, method) then