Merge pull request #16 from MycroftAI/changing-expiration-token-time

Changing the selene expiration time from 30 days to 1 day
pull/17/head
Chris Veilleux 2018-11-07 14:34:12 -06:00 committed by GitHub
commit f1f472817a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 8 deletions

View File

@ -5,7 +5,7 @@ from time import time
import requests as service_request
from selene_util.api import SeleneEndpoint, APIError
from selene_util.auth import encode_auth_token, THIRTY_DAYS
from selene_util.auth import encode_auth_token, ONE_DAY
class AuthenticateAntisocialEndpoint(SeleneEndpoint):
@ -47,7 +47,7 @@ class AuthenticateAntisocialEndpoint(SeleneEndpoint):
self.config['SECRET_KEY'], self.users_uuid
)
response_data = dict(
expiration=time() + THIRTY_DAYS,
expiration=time() + ONE_DAY,
seleneToken=self.selene_token,
tartarusToken=self.tartarus_token,
)

View File

@ -1,7 +1,7 @@
from http import HTTPStatus
from selene_util.api import SeleneEndpoint
from selene_util.auth import encode_auth_token, THIRTY_DAYS
from selene_util.auth import encode_auth_token, ONE_DAY
from time import time
import json
@ -30,7 +30,7 @@ class AuthenticateSocialEndpoint(SeleneEndpoint):
)
response_data = dict(
expiration=time() + THIRTY_DAYS,
expiration=time() + ONE_DAY,
seleneToken=self.selene_token,
tartarusToken=self.tartarus_token,
)

View File

@ -3,7 +3,7 @@ import json
from time import time
from selene_util.api import SeleneEndpoint
from selene_util.auth import encode_auth_token, THIRTY_DAYS
from selene_util.auth import encode_auth_token, ONE_DAY
class SocialLoginTokensEndpoint(SeleneEndpoint):
@ -25,7 +25,7 @@ class SocialLoginTokensEndpoint(SeleneEndpoint):
def _build_response(self):
response_data = dict(
expiration=time() + THIRTY_DAYS,
expiration=time() + ONE_DAY,
seleneToken=self.selene_token,
tartarusToken=self.tartarus_token,
)

View File

@ -4,7 +4,7 @@ from time import time
import jwt
THIRTY_DAYS = 2592000
ONE_DAY = 86400
_log = getLogger(__package__)
@ -18,7 +18,7 @@ def encode_auth_token(secret_key, user_uuid):
Generates the Auth Token
:return: string
"""
token_expiration = time() + THIRTY_DAYS
token_expiration = time() + ONE_DAY
payload = dict(iat=datetime.utcnow(), exp=token_expiration, sub=user_uuid)
selene_token = jwt.encode(
payload,