Skip to content

Commit

Permalink
Handle failed authz requests to Arborist (#308)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulineribeyre authored May 25, 2021
1 parent 1f95a9b commit 0101d52
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions indexd/auth/drivers/alchemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,16 @@ def authz(self, method, resource):

try:
# A successful call from arborist returns a bool, else returns ArboristError
if not self.arborist.auth_request(
get_jwt_token(), "indexd", method, resource
):
try:
authorized = self.arborist.auth_request(
get_jwt_token(), "indexd", method, resource
)
except Exception as e:
logger.error(
f"Request to Arborist failed; now checking admin access. Details:\n{e}"
)
authorized = False
if not authorized:
# admins can perform all operations
is_admin = self.arborist.auth_request(
get_jwt_token(), "indexd", method, ["/services/indexd/admin"]
Expand Down

0 comments on commit 0101d52

Please sign in to comment.