def wrapper(*args, **kwargs):
     response = simple_jwt_required(fn)(*args, **kwargs)
     token = get_jwt()
     roles_in_token = current_app.config['JWT_ROLE_CLAIM'](token)
     if [role for role in roles_in_token if role in allowed_roles]:
         return response
     else:
         raise NoAuthorizationError('Does not have required role')
Пример #2
0
 def wrapper(*args, **kwargs):
     response = simple_jwt_required(fn)(*args, **kwargs)
     token = get_jwt()
     try:
         if current_app.config['JWT_ROLE_CLAIM'](token) == role:
             return response
         else:
             raise NoAuthorizationError('Does not have required role')
     except KeyError:
         raise NoAuthorizationError('Does not have required role')
Пример #3
0
 def wrapper(*args, **kwargs):
     return simple_jwt_required(fn)(*args, **kwargs)