From 71edac1585fd3cf6333e8f642339ce63784d4f53 Mon Sep 17 00:00:00 2001 From: Jamie Lennox Date: Wed, 17 Jul 2013 10:46:25 +1000 Subject: Fix XML rendering with empty auth payload. Just add some sensible defaults to places where XML parses for example an empty dictionary as an empty string. Also 'access' shouldn't be considered a plural. Change-Id: I9fb2c4f5c32ed8c2ce8ba4038caaae39590f8c1a --- keystone/auth/controllers.py | 2 +- keystone/common/serializer.py | 3 ++- keystone/token/controllers.py | 5 +++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/keystone/auth/controllers.py b/keystone/auth/controllers.py index cc4c1605..c4ca3f6f 100644 --- a/keystone/auth/controllers.py +++ b/keystone/auth/controllers.py @@ -225,7 +225,7 @@ class AuthInfo(object): :returns: list of auth method names """ - return self.auth['identity']['methods'] + return self.auth['identity']['methods'] or [] def get_method_data(self, method): """Get the auth method payload. diff --git a/keystone/common/serializer.py b/keystone/common/serializer.py index 597fbfd8..4355a059 100644 --- a/keystone/common/serializer.py +++ b/keystone/common/serializer.py @@ -125,7 +125,8 @@ class XmlDeserializer(object): values = values or text or {} decoded_tag = XmlDeserializer._tag_name(element.tag, namespace) list_item_tag = None - if decoded_tag[-1] == 's' and len(values) == 0: + if (decoded_tag[-1] == 's' and len(values) == 0 and + decoded_tag != 'access'): # FIXME(gyee): special-case lists for now unti we # figure out how to properly handle them. # If any key ends with an 's', we are assuming it is a list. diff --git a/keystone/token/controllers.py b/keystone/token/controllers.py index 4914d305..7a5b9be3 100644 --- a/keystone/token/controllers.py +++ b/keystone/token/controllers.py @@ -262,6 +262,11 @@ class Auth(controller.V2Controller): if 'REMOTE_USER' not in context: raise ExternalAuthNotApplicable() + #NOTE(jamielennox): xml and json differ and get confused about what + # empty auth should look like so just reset it. + if not auth: + auth = {} + username = context['REMOTE_USER'] try: user_ref = self.identity_api.get_user_by_name( -- cgit