summaryrefslogtreecommitdiff
path: root/apifw/bottleapp.py
diff options
context:
space:
mode:
Diffstat (limited to 'apifw/bottleapp.py')
-rw-r--r--apifw/bottleapp.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/apifw/bottleapp.py b/apifw/bottleapp.py
index 20e57ef..7e1572d 100644
--- a/apifw/bottleapp.py
+++ b/apifw/bottleapp.py
@@ -108,9 +108,10 @@ class BottleAuthorizationPlugin:
def apply(self, callback, route):
def wrapper(*args, **kwargs):
-
if self.needs_authorization(route):
- self.assert_authorized(route)
+ claims = self.get_token_claims()
+ kwargs['claims'] = claims
+ self.assert_authorized(route, claims)
return callback(*args, **kwargs)
return wrapper
@@ -122,10 +123,13 @@ class BottleAuthorizationPlugin:
logging.debug('authz_routes: %r', self._authz_routes)
return key in self._authz_routes
- def assert_authorized(self, route):
+ def get_token_claims(self):
value = self.get_authorization_header(bottle.request)
token = self.parse_authorization_header(value)
claims = self.parse_token(token)
+ return claims
+
+ def assert_authorized(self, route, claims):
self.check_issuer(claims)
if not self.scope_allows_route(claims['scope'], route):
self.raise_forbidden(