Beispiel #1
0
 def decorated(*args, **kwargs):
     auth = request.authorization
     if not auth or not helper.check_credentials(
             Config.FLASK_BASIC_AUTH_USER, Config.FLASK_BASIC_AUTH_PASS,
             auth.username, auth.password):
         helper.middle_logic([
             {
                 "try": splunk_middleware.basic_authentication_failed,
                 "fail": []
             },
             {
                 "try": splunk.log_to_splunk,
                 "fail": []
             },
         ],
                             config=Config,
                             request=request)
         logging.warning(
             "Request denied - unauthorized - IP Address: {}".format(
                 request.remote_addr))
         message = {'error': 'Unauthorized'}
         resp = jsonify(message)
         resp.status_code = 401
         return resp
     return f(*args, **kwargs)
Beispiel #2
0
 def decorated(*args, **kwargs):
     auth = request.authorization
     if not auth or not helper.check_credentials(
             Config.FLASK_BASIC_AUTH_USER, Config.FLASK_BASIC_AUTH_PASS, auth.username, auth.password):
         message = {'error': 'Unauthorized'}
         resp = jsonify(message)
         resp.status_code = 401
         return resp
     return f(*args, **kwargs)
Beispiel #3
0
 def decorated(*args, **kwargs):
     auth = request.authorization
     if not auth or not helper.check_credentials(
             Config.FLASK_BASIC_AUTH_USER, Config.FLASK_BASIC_AUTH_PASS,
             auth.username, auth.password):
         logging.warning(
             "Request denied - unauthorized - IP Address: {}".format(
                 request.remote_addr))
         message = {'error': 'Unauthorized'}
         resp = jsonify(message)
         resp.status_code = 401
         return resp
     return f(*args, **kwargs)