Making the token expiry time configurable

Change-Id: Id33591decdb14f4dc57f1afe7a4554af20d5e0da
This commit is contained in:
adriant 2015-11-25 14:08:02 +13:00
parent 11ba13f83f
commit 27446fb781
4 changed files with 10 additions and 2 deletions

View File

@ -55,6 +55,9 @@ DEFAULT_REGION: RegionOne
TOKEN_SUBMISSION_URL: http://192.168.122.160:8080/token/
# time for the token to expire in hours
TOKEN_EXPIRE_TIME: 24
# Additonal actions for views:
# - The order of the actions matters. These will run after the default action,
# in the given order.

View File

@ -11,7 +11,7 @@ import hashlib
def create_token(task):
# expire needs to be made configurable.
expire = timezone.now() + timedelta(hours=24)
expire = timezone.now() + timedelta(hours=settings.TOKEN_EXPIRE_TIME)
# is this a good way to create tokens?
uuid = uuid4().hex

View File

@ -143,6 +143,8 @@ DEFAULT_REGION = CONFIG['DEFAULT_REGION']
TOKEN_SUBMISSION_URL = CONFIG['TOKEN_SUBMISSION_URL']
TOKEN_EXPIRE_TIME = CONFIG['TOKEN_EXPIRE_TIME']
# Additonal actions for views:
# - The order of the actions matters. These will run after the default action,
# in the given order.

View File

@ -70,6 +70,8 @@ DEFAULT_REGION = 'RegionOne'
TOKEN_SUBMISSION_URL = 'http://localhost:8080/token/'
TOKEN_EXPIRE_TIME = 24
# Additonal actions for views:
# - The order of the actions matters. These will run after the default action,
# in the given order.
@ -162,5 +164,6 @@ conf_dict = {
"DEFAULT_REGION": DEFAULT_REGION,
"TASK_SETTINGS": TASK_SETTINGS,
"ACTION_SETTINGS": ACTION_SETTINGS,
"TOKEN_SUBMISSION_URL": TOKEN_SUBMISSION_URL
"TOKEN_SUBMISSION_URL": TOKEN_SUBMISSION_URL,
"TOKEN_EXPIRE_TIME": TOKEN_EXPIRE_TIME
}