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')
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')
def wrapper(*args, **kwargs): return simple_jwt_required(fn)(*args, **kwargs)