Selectively disable token caching

* Token caching can cause errors when a user is removed from a
  project when they have a still valid token for it.
* Default was to cache for 5 minutes
* This adds a setting in the conf file that will set the cache
  time.
* -1 Disables the cache

Change-Id: I70b05f6a09b195dd87452689eb6e211d812fc8c8
Closes-Bug:1736304
This commit is contained in:
Amelia Cordwell 2017-12-05 16:35:33 +13:00
parent bfef179935
commit 41cc1b9435
4 changed files with 9 additions and 0 deletions

View File

@ -165,6 +165,8 @@ PLUGIN_SETTINGS = CONFIG.get('PLUGIN_SETTINGS', {})
ROLES_MAPPING = CONFIG['ROLES_MAPPING']
TOKEN_CACHE_TIME = CONFIG.get('TOKEN_CACHE_TIME', 60)
PROJECT_QUOTA_SIZES = CONFIG.get('PROJECT_QUOTA_SIZES')
QUOTA_SIZES_ASC = CONFIG.get('QUOTA_SIZES_ASC', [])

View File

@ -386,6 +386,8 @@ QUOTA_SIZES_ASC = ['small', 'medium', 'large']
SHOW_ACTION_ENDPOINTS = True
TOKEN_CACHE_TIME = 60
conf_dict = {
"DEBUG": True,
"SECRET_KEY": SECRET_KEY,
@ -405,4 +407,5 @@ conf_dict = {
"PROJECT_QUOTA_SIZES": PROJECT_QUOTA_SIZES,
"SHOW_ACTION_ENDPOINTS": SHOW_ACTION_ENDPOINTS,
"QUOTA_SIZES_ASC": QUOTA_SIZES_ASC,
"TOKEN_CACHE_TIME": TOKEN_CACHE_TIME,
}

View File

@ -45,5 +45,6 @@ conf = {
"auth_url": settings.KEYSTONE['auth_url'],
'delay_auth_decision': True,
'include_service_catalog': False,
'token_cache_time': settings.TOKEN_CACHE_TIME,
}
application = AuthProtocol(application, conf)

View File

@ -410,6 +410,9 @@ PROJECT_QUOTA_SIZES:
router: 10
port: 500
# Time in seconds to cache token from Keystone
TOKEN_CACHE_TIME: 600
# Ordered list of quota sizes from smallest to biggest
QUOTA_SIZES_ASC:
- small