From 36cff999e58711a32efef8daff540b09e67554af Mon Sep 17 00:00:00 2001 From: ReemMahmoud Date: Tue, 9 Jan 2018 12:02:18 +0200 Subject: Add pdp-set exception handling Change-Id: Iae4386063cc53cfa90a3410fb97c2d4e80559986 Signed-off-by: ReemMahmoud --- moon_authz/moon_authz/api/authorization.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'moon_authz') diff --git a/moon_authz/moon_authz/api/authorization.py b/moon_authz/moon_authz/api/authorization.py index ea177d81..e939604b 100644 --- a/moon_authz/moon_authz/api/authorization.py +++ b/moon_authz/moon_authz/api/authorization.py @@ -9,6 +9,7 @@ import logging import flask from flask import request from flask_restful import Resource +from python_moonutilities import exceptions logger = logging.getLogger("moon.authz.api." + __name__) @@ -86,6 +87,8 @@ class Authz(Resource): scopes_list = list() current_header_id = self.context.headers[self.context.index] # Context.update_target(context) + if not self.context.pdp_set: + raise exceptions.PdpUnknown current_pdp = self.context.pdp_set[current_header_id] category_list = list() category_list.extend(current_pdp["meta_rules"]["subject_categories"]) -- cgit 1.2.3-korg