Rapportsystem API - of D03N
Hovedprosjekt FiV Programmering 20-24
Loading...
Searching...
No Matches
valid_token.py
Go to the documentation of this file.
1#importing the required modules
2from functools import wraps
3from USER_session import tokenHandler as TH
4from flask_jwt_extended import jwt_required
5
6#function for valid session requirement
8 current_user = TH.UserTokenHandler()
9 @wraps(func)
10 def wrapped(*args, **kwargs):
11 #gets the current user and checks if token is valid
12 auth = current_user.is_authenticated()
13 if not auth.get("AUTH", False):
14 return {"Error": "No access or session expired", "Message": auth}
15 return func(*args, **kwargs)
16 return wrapped
17
18
require_valid_token(func)
Definition valid_token.py:7