Merge "Handle tokens created and quickly revoked with insufficient timestamp precision"

This commit is contained in:
Jenkins 2015-09-11 17:47:23 +00:00 committed by Gerrit Code Review
commit b273faf0ae
2 changed files with 12 additions and 5 deletions

View File

@ -220,7 +220,7 @@ class RevokeTree(object):
# The last (leaf) level is checked in a special way because we
# verify issued_at field differently.
try:
return revoke_map['issued_before'] > token_data['issued_at']
return revoke_map['issued_before'] >= token_data['issued_at']
except KeyError:
return False

View File

@ -1212,11 +1212,18 @@ class AuthWithTrust(AuthTest):
self.controller.authenticate, {}, request_body)
unscoped_token = self.get_unscoped_token(self.trustor['name'])
context = self._create_auth_context(
# FIXME(dolph): Due to bug 1488208, this token is already "revoked,"
# even though we just created it. Further, this token should be valid
# because we've only revoked role assignments (we haven't done anything
# that should affect unscoped tokens). The code commented out after the
# assertRaises should be restored when this bug is fixed.
self.assertRaises(
exception.TokenNotFound,
self._create_auth_context,
unscoped_token['access']['token']['id'])
trust = self.trust_controller.get_trust(context,
new_trust['id'])['trust']
self.assertEqual(3, trust['remaining_uses'])
# trust = self.trust_controller.get_trust(context,
# new_trust['id'])['trust']
# self.assertEqual(3, trust['remaining_uses'])
def test_v2_trust_token_contains_trustor_user_id_and_impersonation(self):
new_trust = self.create_trust(self.sample_data, self.trustor['name'])