27 Commits

Author SHA1 Message Date
Ionuț Arțăriși
5cd2fa9121 fix unit test when memcache middleware is not configured
Fixes:

keystoneclient.middleware.auth_token: INFO: Starting keystone auth_token middlewa
re
keystoneclient.middleware.auth_token: INFO: Using /opt/stack/keystone/examples/pk
i/certs as cache directory for signing certificate
keystoneclient.middleware.auth_token: DEBUG: Authenticating user token
keystoneclient.middleware.auth_token: DEBUG: Removing headers from request enviro
nment: X-Identity-Status,X-Tenant-Id,X-Tenant-Name,X-User-Id,X-User-Name,X-Roles,
X-Service-Catalog,X-User,X-Tenant,X-Role
keystoneclient.middleware.auth_token: DEBUG: Keystone did not return json-encoded
 body
keystoneclient.middleware.auth_token: DEBUG: Marking token invalid-token as unaut
horized in memcache
keystoneclient.middleware.auth_token: DEBUG: Token validation failure.
Traceback (most recent call last):
  File "/opt/stack/python-keystoneclient/keystoneclient/middleware/auth_token.py"
, line 574, in _validate_user_token
    data = self.verify_uuid_token(user_token, retry)
  File "/opt/stack/python-keystoneclient/keystoneclient/middleware/auth_token.py"
, line 824, in verify_uuid_token
    self._cache_store_invalid(user_token)
  File "/opt/stack/python-keystoneclient/keystoneclient/middleware/auth_token.py"
, line 794, in _cache_store_invalid
    self._cache_store(token, 'invalid')
  File "/opt/stack/python-keystoneclient/keystoneclient/middleware/auth_token.py"
, line 771, in _cache_store
    timeout=self.token_cache_time)
TypeError: set() got an unexpected keyword argument 'timeout'
keystoneclient.middleware.auth_token: DEBUG: Marking token invalid-token as unaut
horized in memcache

This can be reproduced on devstack.

Fixes bug 1102520

Change-Id: Ib9e110d60df40e30d74c3059bd25e459a95f9850
2013-02-15 10:53:27 +01:00
Jenkins
9916227f97 Merge "fixes bug 1074172" 2012-11-08 18:33:05 +00:00
Joe Heck
7cc02c80cf fixes bug 1074172
updated diablo token based on output from diablo/stable keystone
added expiry to example tokens for test_auth_middleware
added a stack based HTTP response to test_auth_middleware to verify
sequencing

Change-Id: I738b0e9c1a0e62ad86adb95ec0b73f621513f7d4
2012-11-07 20:09:22 -08:00
Guang Yee
fddacf7bce bug 1069945: generate certs for the tests in one place
and doc how to install signing certificate from an external CA

Change-Id: I92feb8eaeea617211ee7132480ac7a63bf0a1bf1
2012-11-05 12:27:14 -08:00
Adam Young
75496bbe69 auth_token hash pki
key PKI tokens on hash in memcached when accessed by auth_token
middelware

Bug 1073343

Change-Id: I32e5481f82fd110c855d7e1138c3d43c73099bbb
2012-11-01 14:10:28 -04:00
Zhongyue Luo
4f39aa2b94 Backslash continuation cleanup
Removed unnecessary backslash continuations
Added backslash continuation rules to HACKING.rst

Change-Id: Id91da5b7e9be4d4587dded95fe7a0415240213ec
2012-09-19 11:00:55 +08:00
Jenkins
15635261a4 Merge "Removed/fixed unused variable references" 2012-09-04 21:43:58 +00:00
Jenkins
8707bc65b9 Merge "Removed unused imports" 2012-09-04 16:04:10 +00:00
Jenkins
0843443434 Merge "Fixed: test_default_tenant_uuid_token not running" 2012-09-04 15:51:22 +00:00
Dolph Mathews
a41141285e Fixed: test_default_tenant_uuid_token not running
- Two tests shared the same name, so the first one was not executed
- Module-level variable name out of date

Change-Id: I206aa9589cb95a2fb40b9f0cf5e2bc1323b837ee
2012-08-30 12:58:50 +00:00
Dolph Mathews
ac95f832d4 Removed/fixed unused variable references
Change-Id: Ifed4fc2158e9eb003561620504d2d35e07cdd3bd
2012-08-30 03:26:30 -05:00
Dolph Mathews
b82a0e2b22 HACKING compliance & staticly init module vars
- HACKING: "When defining global constants, define them before functions
  and classes"
- Statically initializing other module variables to None

Change-Id: I8d01e179262a8b16dbe49edef8e23260970c84a0
2012-08-30 03:24:42 -05:00
Dolph Mathews
7c93e8407d Removed unused imports
Change-Id: I203a1256cb4395ad330c19a14870171420daa065
2012-08-29 14:40:52 -05:00
Adam Young
3fa4ba537e Fix auth_token middleware to fetch revocation list as admin.
Make the revocation list into a JSON document and get the Vary header.
This will also allow the revocation list to carry additional
information in the future, to include sufficient information for the
calling application to figure out how to get the certificates it
requires.

Bug 1038309

Change-Id: I4a41cbd8a7352e5b5f951027d6f2063b169bce89
2012-08-23 10:51:20 -04:00
Maru Newby
7b70818954 PKI Token revocation
Co-authored-by: Adam Young <ayoung@redhat.com>

Token revocations are captured in the backends,

During upgrade, all previous tickets are defaulted to valid.

Revocation list returned as a signed document and can be fetched in an admin context via HTTP

Change config values for enable diable PKI

In the auth_token middleware,  the revocation list is fetched prior
to validating tokens. Any tokens that are on the revocation list
will be treated as invalid.

Added in PKI token tests that check the same logic as the UUID tests.
Sample data for the tests is read out of the signing directory.

dropped number on sql scripts to pass tests.

Also fixes 1031373

Bug 1037683

Change-Id: Icef2f173e50fe3cce4273c161f69d41259bf5d23
2012-08-16 15:07:31 -04:00
Jenkins
a7d73d2c4b Merge "Admin Auth URI prefix" 2012-07-13 15:08:14 +00:00
Dan Prince
86177dff68 Prevent service catalog injection in auth_token.
Updates the auth_token middleware to explicitly prevent
X-Service-Catalog headers from being injected into responses.
In general Keystone would override these with its own service
catalog... however since X-Service-Catalog is optional and
not all implementations/calls return it is good to be safe and
just remove incoming X-Service-Catalog headers if they are set.

Fixes LP Bug #1023998.

Change-Id: I9497937abd1b434b42b40bc943a508dd7f1a3585
2012-07-12 14:49:50 -04:00
ayoung
ae0515c3a0 Admin Auth URI prefix
Allows the prepending of a prefix to the URI used for admin tasks.  This allows URIs like
https://hostname/keystone/main/v2.0

PEP8 fix
Added To Unit test to ensure auth_prefix is checked

Bug: 994860
Change-Id: I851e059e8b17c1bc02ab93d8b09a3fb47b9d3fee
2012-07-12 13:56:20 -04:00
Zhongyue Luo
a7417e26d8 Reorder test imports by full import path
Fixes bug #1020182

Reorder imports of modules in keystone/tests.

Change-Id: I2ff61dd3d9486281b4a2a889e4dc8b9105c87d49
2012-07-03 00:21:39 +08:00
Zhongyue Luo
cb747079d0 Keystone should use openstack.common.jsonutils
Implements blueprint use-common-jsonutils

1. Edit openstack-common.conf and import keystone/openstack/common/jsonutils.py
2. Remove json package imports and replace with jsonutils

Client code in vendor/ hasn't been changed

Change-Id: I57c670fde9f2c2241eddab1b012e8d5e6a72deb7
2012-06-28 06:04:53 +08:00
Anthony Young
cc91786a5b Pass serviceCatalog in auth_token middleware
* This will allow  for chained requests (novaclient -> nova -> cinder)
 * Fixes bug 1010237

Change-Id: Iab126cb1f2fb01ca7da24fa9fe97ec81ee96e455
2012-06-19 16:53:09 -05:00
Pádraig Brady
b71fb3de89 fix importing of optional modules in auth_token
* keystone/middleware/auth_token.py: Catch the
correct exception so that the memcache and iso8601
modules can be optional as intended.
* tests/test_auth_token_middleware.py: Test
the ImportError path
* keystone/test.py: Add a new mixin class to
support disabling importing of a module.

Bug: 1003715
Change-Id: I87cc2f3bc79b17a52ea672bac7e0ebcf9e1fce57
2012-06-07 16:46:21 +01:00
Chmouel Boudjnah
3a296a458c Spring cleaning, fix PEP8 violations.
Change-Id: Ide832cd64c9b285213e23901eaf81946d504e726
2012-03-20 22:41:40 +00:00
Brian Lamar
ab6be05068 Update username -> name in token response.
Tokens validation responses contain user information. The API docs
seem to indicate token["user"]["name"] contains the username but
currently the auth_token.py middleware checks for
token["user"]["username"]. This updates that check and the tests.

Fixes bug 955563

Change-Id: Ib2fbf6fcea87f7066394cf14c18158f1e5eeaf06
2012-03-14 18:30:16 -04:00
Dolph Mathews
73af033ded Improved legacy tenancy resolution (bug 951933)
Change-Id: Ia6fd5eb57e8d7f90328117351f7b814b1b4495dc
2012-03-13 14:29:42 -05:00
Chmouel Boudjnah
1e07b98d77 Fix iso8601 import/use and date comparaison.
- Store the unix time from iso8601.parse_date to compare against
  time.time.
- on a WSGI environement the import don't get passed to the methods from
  __init__ use a self. variable.
- Fixes bug 951603.
- Add unit tests.
- Add iso8601 to test-requires.

Change-Id: Ia8af8b203d1310d5ae6868c3a14dfdf68d6e5331
2012-03-12 22:48:49 +01:00
Brian Waldon
a863c13672 Add simple set of tests for auth_token middleware
Change-Id: Ie959e91dc555e35b8e5ba4b01c68a3f232efc115
2012-03-10 14:21:41 -08:00