~ubuntu-branches/ubuntu/raring/keystone/raring-updates

« back to all changes in this revision

Viewing changes to keystone/token/backends/memcache.py

  • Committer: Package Import Robot
  • Author(s): Adam Gandelman
  • Date: 2013-10-17 13:52:59 UTC
  • mfrom: (1.1.37)
  • mto: This revision was merged to the branch mainline in revision 50.
  • Revision ID: package-import@ubuntu.com-20131017135259-dqiwbrzjs1q4mp6q
Tags: 1:2013.1.4-0ubuntu1
* Resynchronize with stable/grizzly (9666fc0) (LP: #1241202):
  - [6792499] periodic-keystone-python27-stable-grizzly fails due to"No
    module named netaddr"   LP: 1212939
  - [775d7a7] Fix and test token revocation list API
  - [0876ea2] N+1 lookups in groups SQL LP: 1218675
  - [afbc75b] Disabling a tenant would not disable a user token LP: 1179955
  - [9666fc0] User operations with LDAP Identity and
    enabled_mask/user_enabled_default fail LP: 1210175

Show diffs side-by-side

added added

removed removed

Lines of Context:
84
84
                        raise exception.UnexpectedError(msg)
85
85
        return copy.deepcopy(data_copy)
86
86
 
87
 
    def _add_to_revocation_list(self, data):
88
 
        data_json = jsonutils.dumps(data)
 
87
    def _add_to_revocation_list(self, token_id, token_data):
 
88
        data_json = jsonutils.dumps({'id': token_id,
 
89
                                     'expires': token_data['expires']})
89
90
        if not self.client.append(self.revocation_key, ',%s' % data_json):
90
91
            if not self.client.add(self.revocation_key, data_json):
91
92
                if not self.client.append(self.revocation_key,
95
96
 
96
97
    def delete_token(self, token_id):
97
98
        # Test for existence
98
 
        data = self.get_token(token.unique_id(token_id))
99
 
        ptk = self._prefix_token_id(token.unique_id(token_id))
 
99
        token_id = token.unique_id(token_id)
 
100
        data = self.get_token(token_id)
 
101
        ptk = self._prefix_token_id(token_id)
100
102
        result = self.client.delete(ptk)
101
 
        self._add_to_revocation_list(data)
 
103
        self._add_to_revocation_list(token_id, data)
102
104
        return result
103
105
 
104
106
    def list_tokens(self, user_id, tenant_id=None, trust_id=None):