示例#1
0
文件: auth.py 项目: imkarrer/jumpgate
def get_token_details(token, tenant_id=None):
    try:
        token_details = json.loads(aes.decode_aes(base64.b64decode(token)))
    except (TypeError, ValueError):
        raise exceptions.Unauthorized('Invalid Key')

    if time.time() > token_details['expires']:
        raise exceptions.Unauthorized('Expired Key')

    if tenant_id and str(token_details['tenant_id']) != tenant_id:
        raise exceptions.Unauthorized('Tenant/token Mismatch')

    return token_details
示例#2
0
文件: core.py 项目: imkarrer/jumpgate
 def token_from_id(self, token_id):
     try:
         return json.loads(aes.decode_aes(base64.b64decode(token_id)))
     except (TypeError, ValueError):
         raise exceptions.InvalidTokenError('Malformed token')
示例#3
0
 def token_from_id(self, token_id):
     try:
         return json.loads(aes.decode_aes(base64.b64decode(token_id)))
     except (TypeError, ValueError):
         raise exceptions.InvalidTokenError('Malformed token')