Cache service providers on token validation

On fernet token validation we rebuild the entire token catalog. This includes
rebuilding the service providers references in the token if using a federated
token. In the mitaka release, patches were added to cache user catalogs and
role assignments. This allows us to do the same thing for service providers,
which decreases the time spent in get_token_data() by 34%.

Co-Authored-By: Dolph Mathews <dolph.mathews@gmail.com>

Related-Bug: 1489061
Change-Id: I3dfe66880295ef36a18ca3e384191106b74be795
This commit is contained in:
Lance Bragstad
2016-06-03 04:19:45 +00:00
parent 510f00f365
commit 54da44bd41

View File

@@ -15,6 +15,7 @@
from oslo_config import cfg
from oslo_log import versionutils
from keystone.common import cache
from keystone.common import dependency
from keystone.common import extension
from keystone.common import manager
@@ -23,6 +24,9 @@ from keystone.federation.backends import base
from keystone.federation import utils
# This is a general cache region for service providers.
MEMOIZE = cache.get_memoization_decorator(group='federation')
CONF = cfg.CONF
EXTENSION_DATA = {
'name': 'OpenStack Federation APIs',
@@ -63,6 +67,7 @@ class Manager(manager.Manager):
raise exception.UnsupportedDriverVersion(
driver=CONF.federation.driver)
@MEMOIZE
def get_enabled_service_providers(self):
"""List enabled service providers for Service Catalog.