"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "keystone/credential/core.py" between
keystone-17.0.0.tar.gz and keystone-18.0.0.tar.gz

About: OpenStack Keystone (Core Service: Identity) provides an authentication and authorization service for other OpenStack services. Provides a catalog of endpoints for all OpenStack services.
The "Victoria" series (latest release).

core.py  (keystone-17.0.0):core.py  (keystone-18.0.0)
skipping to change at line 87 skipping to change at line 87
encrypted_blob, key_hash = ( encrypted_blob, key_hash = (
PROVIDERS.credential_provider_api.encrypt( PROVIDERS.credential_provider_api.encrypt(
credential['blob'] credential['blob']
) )
) )
credential_copy['encrypted_blob'] = encrypted_blob credential_copy['encrypted_blob'] = encrypted_blob
credential_copy['key_hash'] = key_hash credential_copy['key_hash'] = key_hash
credential_copy.pop('blob', None) credential_copy.pop('blob', None)
return credential_copy return credential_copy
def _assert_limit_not_exceeded(self, user_id):
user_limit = CONF.credential.user_limit
if user_limit >= 0:
cred_count = len(self.list_credentials_for_user(user_id))
if cred_count >= user_limit:
raise exception.CredentialLimitExceeded(
limit=user_limit)
@manager.response_truncated @manager.response_truncated
def list_credentials(self, hints=None): def list_credentials(self, hints=None):
credentials = self.driver.list_credentials( credentials = self.driver.list_credentials(
hints or driver_hints.Hints() hints or driver_hints.Hints()
) )
for credential in credentials: for credential in credentials:
credential = self._decrypt_credential(credential) credential = self._decrypt_credential(credential)
return credentials return credentials
def list_credentials_for_user(self, user_id, type=None): def list_credentials_for_user(self, user_id, type=None):
skipping to change at line 120 skipping to change at line 128
return self._decrypt_credential(credential) return self._decrypt_credential(credential)
@MEMOIZE @MEMOIZE
def _get_credential(self, credential_id): def _get_credential(self, credential_id):
return self.driver.get_credential(credential_id) return self.driver.get_credential(credential_id)
def create_credential(self, credential_id, credential, def create_credential(self, credential_id, credential,
initiator=None): initiator=None):
"""Create a credential.""" """Create a credential."""
credential_copy = self._encrypt_credential(credential) credential_copy = self._encrypt_credential(credential)
user_id = credential_copy['user_id']
self._assert_limit_not_exceeded(user_id)
ref = self.driver.create_credential(credential_id, credential_copy) ref = self.driver.create_credential(credential_id, credential_copy)
if MEMOIZE.should_cache(ref): if MEMOIZE.should_cache(ref):
self._get_credential.set(ref, self._get_credential.set(ref,
credential_copy, credential_copy,
credential_id) credential_id)
self._list_credentials_for_user.invalidate(self, self._list_credentials_for_user.invalidate(self,
ref['user_id'], ref['user_id'],
ref['type']) ref['type'])
self._list_credentials_for_user.invalidate(self, self._list_credentials_for_user.invalidate(self,
ref['user_id'], ref['user_id'],
 End of changes. 2 change blocks. 
0 lines changed or deleted 10 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)