diff options
author | asteroide <thomas.duval@orange.com> | 2015-12-16 16:15:22 +0100 |
---|---|---|
committer | asteroide <thomas.duval@orange.com> | 2015-12-16 16:15:22 +0100 |
commit | 73be8fe3ec13cbb02a8ed0c488fabfe87b37ad7b (patch) | |
tree | e2c337d32172dcc12ea8e4c0792bf9d2f06ed54a /keystonemiddleware-moon/keystonemiddleware/moon_mgrs/authz_mgr | |
parent | 305397bf05d18e654e5c6c6bfe76d79478883fb4 (diff) |
Update and fix the new keystonemiddleware moon manager.
Change-Id: I76c318c7b10e9cfc9b134d4cc29daf3e247cdb20
Diffstat (limited to 'keystonemiddleware-moon/keystonemiddleware/moon_mgrs/authz_mgr')
-rw-r--r-- | keystonemiddleware-moon/keystonemiddleware/moon_mgrs/authz_mgr/authz_mgr.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/keystonemiddleware-moon/keystonemiddleware/moon_mgrs/authz_mgr/authz_mgr.py b/keystonemiddleware-moon/keystonemiddleware/moon_mgrs/authz_mgr/authz_mgr.py index af519225..0d81a790 100644 --- a/keystonemiddleware-moon/keystonemiddleware/moon_mgrs/authz_mgr/authz_mgr.py +++ b/keystonemiddleware-moon/keystonemiddleware/moon_mgrs/authz_mgr/authz_mgr.py @@ -38,6 +38,8 @@ class AuthzMgr(object): authz_mgr_fh = logging.FileHandler(CONF.moon_authz_mgr["authz_mgr_logfile"]) self._LOG.setLevel(logging.DEBUG) self._LOG.addHandler(authz_mgr_fh) + self._conf = conf + self.response_content = "" def _deny_request(self, code): error_table = { @@ -57,7 +59,6 @@ class AuthzMgr(object): resp.body = error_msg return resp - def treat_request(self, auth_token, agent_data): if not agent_data['resource_id']: agent_data['resource_id'] = "servers" @@ -65,8 +66,8 @@ class AuthzMgr(object): headers = {'X-Auth-Token': auth_token} self._LOG.debug('X-Auth-Token={}'.format(auth_token)) try: - _url ='{}/v3/OS-MOON/authz/{}/{}/{}/{}'.format( - self._request_uri, + _url = '{}/moon/authz/{}/{}/{}/{}'.format( + self._conf["_request_uri"], agent_data['tenant_id'], agent_data['user_id'], agent_data['resource_id'], @@ -74,7 +75,7 @@ class AuthzMgr(object): self._LOG.info(_url) response = requests.get(_url, headers=headers, - verify=self._verify) + verify=self._conf["_verify"]) except requests.exceptions.RequestException as e: self._LOG.error(_LI('HTTP connection exception: %s'), e) resp = self._deny_request('InvalidURI') @@ -93,7 +94,7 @@ class AuthzMgr(object): elif response.status_code == 200: answer = json.loads(response.content) - self._LOG.debug("action_id={}/{}".format(agent_data['OS_component'] , agent_data['action_id'])) + self._LOG.debug("action_id={}/{}".format(agent_data['OS_component'], agent_data['action_id'])) self._LOG.debug(answer) if "authz" in answer and answer["authz"]: return response |