optimize authentication
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Torma Kristóf 2020-11-26 06:28:49 +01:00
parent c73c71c9e9
commit 4a6ddc4010
1 changed files with 7 additions and 0 deletions

View File

@ -193,7 +193,14 @@ class ItemApi(Resource):
"""
See: https://swagger.kmlabz.com/?urls.primaryName=onSpot%20Backend#/backend/getItem
"""
encryptor = EncryptedUserRedis(ENCODED_SECRET_KEY)
def get(self, itemid: str):
try:
flaskred.get(request.headers.get('Authorization')).decode('UTF-8')
except Exception as e:
current_app.logger.warning(e)
abort(401, "unauthorized")
try:
item_type = flaskred.get(itemid).decode('UTF-8')
except Exception as e: