Browse Source

Support use of token value in place of password.

blueprint horizon-webui

(Auto-linking to blueprint either doesn't work for this project
or requires additional info not prescribed. Here is full link:
https://blueprints.launchpad.net/inception/+spec/horizon-webui

While python-novaclient will re-authenticate using an internally
saved copy of an authorization token, this capability is not
exposed to its API user requiring the use of a password whenever
creating a Client object.  In order to authenticate requests made
on behalf of a web (horizon) user this capability needs to be
utilized as the horizon web app has only a token once the user
logs in.  This change depends on the structure of the client
and is the first place to look for problems once the underlying
API software is revised.

Partially implements: blueprint horizon-webui

Change-Id: Ifa9cb7877eabff1514cb2272407d6daf08beef7f
Andrew Forrest 5 years ago
parent
commit
e505d194d3
1 changed files with 7 additions and 0 deletions
  1. 7
    0
      inception/orchestrator.py

+ 7
- 0
inception/orchestrator.py View File

@@ -39,6 +39,7 @@ import functools
39 39
 import logging
40 40
 import os
41 41
 import Queue
42
+import re
42 43
 import subprocess
43 44
 import time
44 45
 
@@ -229,6 +230,12 @@ class Orchestrator(object):
229 230
                              os.environ['OS_PASSWORD'],
230 231
                              os.environ['OS_TENANT_NAME'],
231 232
                              os.environ['OS_AUTH_URL'])
233
+
234
+        # If the password offered is actually a 32 byte hex digit string
235
+        # then it's probably a token
236
+        if re.match('\A[\da-fA-F]{32}\Z', os.environ['OS_PASSWORD']):
237
+            self.client.client.auth_token = os.environ['OS_PASSWORD']
238
+
232 239
         self._gateway_id = None
233 240
         self._gateway_ip = None
234 241
         self._gateway_name = None

Loading…
Cancel
Save