Files
notifications-admin/app/custom_auth.py

19 lines
520 B
Python
Raw Normal View History

2022-07-01 07:58:58 -07:00
from flask import jsonify, request
2022-08-05 00:25:03 -07:00
from flask_basicauth import BasicAuth
2022-07-01 07:58:58 -07:00
class CustomBasicAuth(BasicAuth):
"""
2022-08-05 00:25:03 -07:00
Description:
Override BasicAuth to permit anonymous healthcheck at /_status?simple=true
2022-07-01 07:58:58 -07:00
"""
2022-08-05 00:25:03 -07:00
def challenge(self):
if "/_status" in request.url:
if request.args.get('elb', None) or request.args.get('simple', None):
return jsonify(status="ok"), 200
return super(CustomBasicAuth, self).challenge()
2022-07-01 07:58:58 -07:00
2022-08-05 00:25:03 -07:00
2022-07-01 11:47:44 -07:00
custom_basic_auth = CustomBasicAuth()