def auth_token_required(fn):
 @wraps(fn)
 def decorated(*args, **kwargs):
  if _check_token():
   return fn(*args, **kwargs)
  if _security._unauthorized_callback:
   return _security._unauthorized_callback()
  else:
   return _get_unauthorized_response()
 return decorated

def auth_token_required ( fn ) : @ wraps ( fn ) def decorated ( * args , ** kwargs ) : if _check_token ( ) : return fn ( * args , ** kwargs ) if _security . _unauthorized_callback : return _security . _unauthorized_callback ( ) else : return _get_unauthorized_response ( ) return decorated
decorator that protects endpoints using token authentication .