Code improvements

Closes #789

Signed-off-by: Tomaz Muraus <to...@tomaz.me>


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/1fda9a5a
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/1fda9a5a
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/1fda9a5a

Branch: refs/heads/trunk
Commit: 1fda9a5a9583a1c7d05532de7b1b0f8147bdf1f3
Parents: 23af550
Author: micafer <micaf...@upv.es>
Authored: Wed May 18 13:04:35 2016 +0200
Committer: Tomaz Muraus <to...@tomaz.me>
Committed: Thu May 26 20:53:02 2016 +0200

----------------------------------------------------------------------
 libcloud/common/openstack_identity.py | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/1fda9a5a/libcloud/common/openstack_identity.py
----------------------------------------------------------------------
diff --git a/libcloud/common/openstack_identity.py 
b/libcloud/common/openstack_identity.py
index fea811a..ee1186f 100644
--- a/libcloud/common/openstack_identity.py
+++ b/libcloud/common/openstack_identity.py
@@ -43,7 +43,7 @@ AUTH_VERSIONS_WITH_EXPIRES = [
     '2.0_password',
     '3.0',
     '3.x_password',
-    '3.x_oidc'
+    '3.x_oidc_access_token'
 ]
 
 # How many seconds to subtract from the auth token expiration time before
@@ -1379,7 +1379,7 @@ class 
OpenStackIdentity_3_0_Connection(OpenStackIdentityConnection):
         return role
 
 
-class OpenStackIdentity_3_0_Connection_OIDC(OpenStackIdentity_3_0_Connection):
+class 
OpenStackIdentity_3_0_Connection_OIDC_access_token(OpenStackIdentity_3_0_Connection):
     """
     Connection class for Keystone API v3.x. using OpenID Connect tokens
     """
@@ -1474,13 +1474,15 @@ class 
OpenStackIdentity_3_0_Connection_OIDC(OpenStackIdentity_3_0_Connection):
 
     def _get_unscoped_token_from_oidc_token(self):
         """
-        Get unscoped token from OIDC token
+        Get unscoped token from OIDC access token
         The OIDC token must be set in the self.key attribute.
         The identity provider name required to get the full path
+        must be set in the self.user_id attribute.
+        The protocol name required to get the full path
         must be set in the self.tenant_name attribute.
         """
-        path = ('/v3/OS-FEDERATION/identity_providers/%s/protocols/oidc/auth' %
-                self.tenant_name)
+        path = ('/v3/OS-FEDERATION/identity_providers/%s/protocols/%s/auth' %
+                (self.user_id, self.tenant_name))
         response = self.request(path,
                                 headers={'Content-Type': 'application/json',
                                          'Authorization': 'Bearer %s' %
@@ -1539,8 +1541,8 @@ def get_class_for_auth_version(auth_version):
         cls = OpenStackIdentity_2_0_Connection
     elif auth_version == '3.x_password':
         cls = OpenStackIdentity_3_0_Connection
-    elif auth_version == '3.x_oidc':
-        cls = OpenStackIdentity_3_0_Connection_OIDC
+    elif auth_version == '3.x_oidc_access_token':
+        cls = OpenStackIdentity_3_0_Connection_OIDC_access_token
     else:
         raise LibcloudError('Unsupported Auth Version requested')
 

Reply via email to