16 lines
561 B
Python
16 lines
561 B
Python
|
import config
|
||
|
|
||
|
def revoke_access(decrypted_token):
|
||
|
if decrypted_token['type'] == 'access':
|
||
|
jti= decrypted_token['jti']
|
||
|
config.redis_conn.setex(jti, config.settings.access_expires, 'true')
|
||
|
return {"detail": "Access token has been revoke"}
|
||
|
raise "Access token required"
|
||
|
|
||
|
def revoke_refresh(decrypted_token):
|
||
|
if decrypted_token['type'] == 'refresh':
|
||
|
jti= decrypted_token['jti']
|
||
|
config.redis_conn.setex(jti, config.settings.refresh_expires, 'true')
|
||
|
return {"detail": "Refresh token has been revoke"}
|
||
|
raise "Refresh token required"
|