diff options
| author | Jenkins <jenkins@review.openstack.org> | 2014-09-21 14:27:53 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2014-09-21 14:27:53 +0000 |
| commit | 0b06683be6d13d21dfffa19be46e1159edb9fce0 (patch) | |
| tree | f6621ce6a48e5471039a57bbd46be88bbcc11518 /keystoneclient/middleware | |
| parent | b0241ad2da13409d477490f6b9bea8a639874c19 (diff) | |
| parent | 5c9c97f1a5dffe5964e945bf68d009fd68e616fc (diff) | |
| download | python-keystoneclient-0b06683be6d13d21dfffa19be46e1159edb9fce0.tar.gz | |
Merge "Fix the condition expression for ssl_insecure"0.11.0
Diffstat (limited to 'keystoneclient/middleware')
| -rw-r--r-- | keystoneclient/middleware/auth_token.py | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/keystoneclient/middleware/auth_token.py b/keystoneclient/middleware/auth_token.py index cf33f04..48bfc5c 100644 --- a/keystoneclient/middleware/auth_token.py +++ b/keystoneclient/middleware/auth_token.py @@ -423,6 +423,27 @@ def safe_quote(s): return urllib.parse.quote(s) if s == urllib.parse.unquote(s) else s +def _conf_values_type_convert(conf): + """Convert conf values into correct type.""" + if not conf: + return {} + _opts = {} + opt_types = dict((o.dest, o.type) for o in opts) + for k, v in six.iteritems(conf): + try: + if v is None: + _opts[k] = v + else: + _opts[k] = opt_types[k](v) + except KeyError: + _opts[k] = v + except ValueError as e: + raise ConfigurationError( + 'Unable to convert the value of %s option into correct ' + 'type: %s' % (k, e)) + return _opts + + class InvalidUserToken(Exception): pass @@ -462,7 +483,10 @@ class AuthProtocol(object): 'This middleware module is deprecated as of v0.10.0 in favor of ' 'keystonemiddleware.auth_token - please update your WSGI pipeline ' 'to reference the new middleware package.') - self.conf = conf + # NOTE(wanghong): If options are set in paste file, all the option + # values passed into conf are string type. So, we should convert the + # conf value into correct type. + self.conf = _conf_values_type_convert(conf) self.app = app # delay_auth_decision means we still allow unauthenticated requests |
