Skip to content

Commit

Permalink
Merge 49ae2e1 into b78a760
Browse files Browse the repository at this point in the history
  • Loading branch information
jessecooper committed Aug 14, 2020
2 parents b78a760 + 49ae2e1 commit 9bfb8a9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions flask_authz/casbin_enforcer.py
Expand Up @@ -48,6 +48,8 @@ def wrapper(*args, **kwargs):
"Enforce Headers Config: %s\nRequest Headers: %s"
% (self.app.config.get("CASBIN_OWNER_HEADERS"), request.headers)
)
# Set resource URI from request
uri = str(request.path)
for header in self.app.config.get("CASBIN_OWNER_HEADERS"):
if header in request.headers:
# Make Authorization Header Parser standard
Expand All @@ -63,7 +65,7 @@ def wrapper(*args, **kwargs):
"decoding is unsupported by flask-casbin at this time"
)
continue
if self.e.enforce(owner, str(request.url_rule), request.method):
if self.e.enforce(owner, uri, request.method):
return func(*args, **kwargs)
else:
# Split header by ',' in case of groups when groups are
Expand All @@ -76,7 +78,7 @@ def wrapper(*args, **kwargs):
% (owner.strip('"'), header)
)
if self.e.enforce(
owner.strip('"'), str(request.url_rule), request.method
owner.strip('"'), uri, request.method
):
return func(*args, **kwargs)
else:
Expand Down

0 comments on commit 9bfb8a9

Please sign in to comment.