Skip to content

Commit

Permalink
Merge pull request #141 from holaplex/mpw/gw-authz-plugin
Browse files Browse the repository at this point in the history
custom unauthorized error based on failed relation checks
  • Loading branch information
mpwsh authored Aug 23, 2023
2 parents 3b3eab1 + 7afa99c commit 5d83c5a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion charts/hub-gateway/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.23.6
version: 0.23.7

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
7 changes: 4 additions & 3 deletions charts/hub-gateway/plugins/authz.lua
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,14 @@ function _M.access(conf, ctx)
end

local req_id = core.request.header(ctx, "X-Request-Id")
local reason = json.encode({
local invalid = table.concat(result.invalid, ", ")
local response = json.encode({
code = status_code,
message = "Unauthorized",
message = "Unauthorized. Unable to access " .. invalid,
request_id = req_id
})

return status_code, reason
return status_code, response
end
end

Expand Down

0 comments on commit 5d83c5a

Please sign in to comment.