summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiao Hanyu <xiaohanyu1988@gmail.com>2014-04-21 17:21:31 +0800
committerXiao Hanyu <xiaohanyu1988@gmail.com>2014-05-26 14:25:02 +0800
commite239fb78e07a86daee3821ccabc3e929cf5ab79f (patch)
tree17188d4a86246b538aa1c4a6a5d60bb7f72e6299
parentc8d0b8a85b59c91a5af83b31a37ca38859e1586c (diff)
downloaddjango_openstack_auth-e239fb78e07a86daee3821ccabc3e929cf5ab79f.tar.gz
Set default auth_url from django settings when auth_url is None
This is useful when users(client web forms) just provide username/password to authenticate with django_openstack_auth. In this case, they can still login if keystone version == 2.0 since keystone v2.0 only requires username/password and auth_url to authenticate. In most cases, auth_url can get from django(horizon)'s settings. Fix-bug: #1316490 Change-Id: I2ed24238adb79b6ef33e4bf20232b6a924ad0b1f
-rw-r--r--openstack_auth/backend.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/openstack_auth/backend.py b/openstack_auth/backend.py
index da41cdb..3fb4ba2 100644
--- a/openstack_auth/backend.py
+++ b/openstack_auth/backend.py
@@ -78,6 +78,9 @@ class KeystoneBackend(object):
endpoint_type = getattr(
settings, 'OPENSTACK_ENDPOINT_TYPE', 'publicURL')
+ if auth_url is None:
+ auth_url = settings.OPENSTACK_KEYSTONE_URL
+
# keystone client v3 does not support logging in on the v2 url any more
if get_keystone_version() >= 3:
auth_url = auth_url.replace('v2.0', 'v3')