summaryrefslogtreecommitdiff
path: root/keystoneclient/auth
diff options
context:
space:
mode:
authorJamie Lennox <jamielennox@redhat.com>2015-03-30 15:51:49 +1100
committerJamie Lennox <jamielennox@redhat.com>2015-03-30 15:59:30 +1100
commitfd16240be482b4841dfafeee404f3a8e2678333e (patch)
tree42b6a14c30364158a3f5916f3ad39fca52f04fbc /keystoneclient/auth
parent3b8a5d02765865fa2db7641535e9c907709d7c6d (diff)
downloadpython-keystoneclient-fd16240be482b4841dfafeee404f3a8e2678333e.tar.gz
Support discovery on the AUTH_INTERFACE
We need to allow get_endpoint(interface=auth.AUTH_INTERFACE, version=X) to support the same version negotiation that the service catalog goes through. This is required to support generic plugins where you often provide an unversioned auth_url to the plugin but need a versioned URL to query for available projects. Change-Id: Id423a538c169264a81c5714e6a9eff9b33912a55 Closes-Bug: #1438013
Diffstat (limited to 'keystoneclient/auth')
-rw-r--r--keystoneclient/auth/identity/base.py41
1 files changed, 22 insertions, 19 deletions
diff --git a/keystoneclient/auth/identity/base.py b/keystoneclient/auth/identity/base.py
index d8cd2a6..d50463d 100644
--- a/keystoneclient/auth/identity/base.py
+++ b/keystoneclient/auth/identity/base.py
@@ -197,26 +197,29 @@ class BaseIdentityPlugin(base.BaseAuthPlugin):
:rtype: string or None
"""
# NOTE(jamielennox): if you specifically ask for requests to be sent to
- # the auth url then we can ignore the rest of the checks. Typically if
- # you are asking for the auth endpoint it means that there is no
- # catalog to query anyway.
+ # the auth url then we can ignore many of the checks. Typically if you
+ # are asking for the auth endpoint it means that there is no catalog to
+ # query however we still need to support asking for a specific version
+ # of the auth_url for generic plugins.
if interface is base.AUTH_INTERFACE:
- return self.auth_url
-
- if not service_type:
- LOG.warn(_LW('Plugin cannot return an endpoint without knowing '
- 'the service type that is required. Add service_type '
- 'to endpoint filtering data.'))
- return None
-
- if not interface:
- interface = 'public'
-
- service_catalog = self.get_access(session).service_catalog
- url = service_catalog.url_for(service_type=service_type,
- endpoint_type=interface,
- region_name=region_name,
- service_name=service_name)
+ url = self.auth_url
+ service_type = service_type or 'identity'
+
+ else:
+ if not service_type:
+ LOG.warn(_LW('Plugin cannot return an endpoint without '
+ 'knowing the service type that is required. Add '
+ 'service_type to endpoint filtering data.'))
+ return None
+
+ if not interface:
+ interface = 'public'
+
+ service_catalog = self.get_access(session).service_catalog
+ url = service_catalog.url_for(service_type=service_type,
+ endpoint_type=interface,
+ region_name=region_name,
+ service_name=service_name)
if not version:
# NOTE(jamielennox): This may not be the best thing to default to