diff options
author | Alex Shatov <alexs@att.com> | 2017-10-27 16:56:08 -0400 |
---|---|---|
committer | Alex Shatov <alexs@att.com> | 2017-10-27 16:56:08 -0400 |
commit | 81a1b05ebd918c3a8148382661f00f3183894f9a (patch) | |
tree | d0fe707fd3e7b8a0f89fa0b3af916fbe29dc69db /policyhandler | |
parent | 2d452d17a679ac85b7a7eba0da8767d6fafb8e4c (diff) |
fixed ClientAuth and Authorization parsing
two formats of ClientAuth and Authorization
* Basic <auth>
* <auth>
Change-Id: I177a86caef6b2a2406277413d5de1972bcf19cfe
Issue-Id: DCAEGEN2-128
Signed-off-by: Alex Shatov <alexs@att.com>
Diffstat (limited to 'policyhandler')
-rw-r--r-- | policyhandler/config.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/policyhandler/config.py b/policyhandler/config.py index 81eaccb..5c7e962 100644 --- a/policyhandler/config.py +++ b/policyhandler/config.py @@ -22,6 +22,7 @@ import os import json import copy +import re import base64 import logging import logging.config @@ -141,8 +142,9 @@ class PolicyEngineConfig(object): try: config = Config.config[Config.FIELD_POLICY_ENGINE] headers = config["headers"] - client_parts = base64.b64decode(headers["ClientAuth"].split()[1]).split(":") - auth_parts = base64.b64decode(headers["Authorization"].split()[1]).split(":") + remove_basic = re.compile(r"(^Basic )") + client_parts = base64.b64decode(remove_basic.sub("", headers["ClientAuth"])).split(":") + auth_parts = base64.b64decode(remove_basic.sub("", headers["Authorization"])).split(":") props = PolicyEngineConfig.PYPDP_URL.format(config["url"], config["path_pdp"], auth_parts[0], auth_parts[1]) |