aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReemMahmoud <rfawzy.ext@orange.com>2018-01-09 12:02:18 +0200
committerReemMahmoud <rfawzy.ext@orange.com>2018-01-09 12:02:18 +0200
commit36cff999e58711a32efef8daff540b09e67554af (patch)
treec644128ed324a1c4862d83a4c3a6b9341b71d67b
parentff82da77d0464292b45f41a935abd5e43a42986f (diff)
Add pdp-set exception handling
Change-Id: Iae4386063cc53cfa90a3410fb97c2d4e80559986 Signed-off-by: ReemMahmoud <rfawzy.ext@orange.com>
-rw-r--r--moon_authz/moon_authz/api/authorization.py3
1 files changed, 3 insertions, 0 deletions
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"])