diff options
author | Jenkins <jenkins@review.openstack.org> | 2015-04-03 05:15:47 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2015-04-03 05:15:47 +0000 |
commit | 0e2a6ce7837307865d8f07f41a16cf4b9d4c056a (patch) | |
tree | c79a51d271fd443c5d9feb0c1caa67ba1860b984 | |
parent | 70c1a15cd59b9125f41be71fb60260bf8d905db9 (diff) | |
parent | 7e99945cc64b8e3432965bffb57dce74312b08e2 (diff) | |
download | django_openstack_auth-0e2a6ce7837307865d8f07f41a16cf4b9d4c056a.tar.gz |
Merge "Hash token only for ASN1 and PKIZ tokens"
-rw-r--r-- | openstack_auth/user.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/openstack_auth/user.py b/openstack_auth/user.py index 57c6d67..43336e5 100644 --- a/openstack_auth/user.py +++ b/openstack_auth/user.py @@ -16,6 +16,7 @@ import logging from django.conf import settings from django.contrib.auth import models +from keystoneclient.common import cms as keystone_cms from keystoneclient import exceptions as keystone_exceptions from openstack_auth import utils @@ -79,7 +80,8 @@ class Token(object): # Token-related attributes self.id = auth_ref.auth_token self.unscoped_token = unscoped_token - if len(self.id) > 64: + if (keystone_cms.is_asn1_token(self.id) + or keystone_cms.is_pkiz(self.id)): algorithm = getattr(settings, 'OPENSTACK_TOKEN_HASH_ALGORITHM', 'md5') hasher = hashlib.new(algorithm) |