mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-25 08:44:23 -04:00
Merge branch 'main' of https://github.com/GSA/notifications-admin into notify-762
This commit is contained in:
@@ -37,7 +37,6 @@ from werkzeug.local import LocalProxy
|
||||
from app import proxy_fix
|
||||
from app.asset_fingerprinter import asset_fingerprinter
|
||||
from app.config import configs
|
||||
from app.custom_auth import CustomBasicAuth
|
||||
from app.extensions import redis_client, zendesk_client
|
||||
from app.formatters import (
|
||||
convert_to_boolean,
|
||||
@@ -122,7 +121,6 @@ from app.url_converters import (
|
||||
login_manager = LoginManager()
|
||||
csrf = CSRFProtect()
|
||||
talisman = Talisman()
|
||||
basic_auth = CustomBasicAuth()
|
||||
|
||||
|
||||
# The current service attached to the request stack.
|
||||
@@ -235,8 +233,6 @@ def create_app(application):
|
||||
login_manager.session_protection = None
|
||||
login_manager.anonymous_user = AnonymousUser
|
||||
|
||||
setup_basic_auth(application)
|
||||
|
||||
# make sure we handle unicode correctly
|
||||
redis_client.redis_store.decode_responses = True
|
||||
|
||||
@@ -583,7 +579,3 @@ def init_jinja(application):
|
||||
]
|
||||
jinja_loader = jinja2.FileSystemLoader(template_folders)
|
||||
application.jinja_loader = jinja_loader
|
||||
|
||||
|
||||
def setup_basic_auth(application):
|
||||
application.basic_auth = CustomBasicAuth(application)
|
||||
|
||||
@@ -28,8 +28,6 @@ class Config(object):
|
||||
# ZENDESK_API_KEY = getenv('ZENDESK_API_KEY')
|
||||
ROUTE_SECRET_KEY_1 = getenv("ROUTE_SECRET_KEY_1", "dev-route-secret-key-1")
|
||||
ROUTE_SECRET_KEY_2 = getenv("ROUTE_SECRET_KEY_2", "dev-route-secret-key-2")
|
||||
BASIC_AUTH_USERNAME = getenv("BASIC_AUTH_USERNAME")
|
||||
BASIC_AUTH_PASSWORD = getenv("BASIC_AUTH_PASSWORD")
|
||||
|
||||
NR_ACCOUNT_ID = getenv("NR_ACCOUNT_ID")
|
||||
NR_TRUST_KEY = getenv("NR_TRUST_KEY")
|
||||
@@ -101,7 +99,6 @@ def _s3_credentials_from_env(bucket_prefix):
|
||||
|
||||
|
||||
class Development(Config):
|
||||
BASIC_AUTH_FORCE = False
|
||||
DEBUG = True
|
||||
SESSION_COOKIE_SECURE = False
|
||||
SESSION_PROTECTION = None
|
||||
@@ -138,7 +135,6 @@ class Test(Development):
|
||||
class Production(Config):
|
||||
HEADER_COLOUR = "#005EA5" # $govuk-blue
|
||||
HTTP_PROTOCOL = "https"
|
||||
BASIC_AUTH_FORCE = True
|
||||
ASSET_DOMAIN = "" # TODO use a CDN
|
||||
ASSET_PATH = "/static/" # TODO use a CDN
|
||||
DEBUG = False
|
||||
@@ -153,7 +149,6 @@ class Production(Config):
|
||||
|
||||
|
||||
class Staging(Production):
|
||||
BASIC_AUTH_FORCE = True
|
||||
HEADER_COLOUR = "#00ff00" # $green
|
||||
|
||||
|
||||
@@ -166,7 +161,6 @@ class Sandbox(Staging):
|
||||
|
||||
|
||||
class Scanning(Production):
|
||||
BASIC_AUTH_FORCE = False
|
||||
HTTP_PROTOCOL = "http"
|
||||
API_HOST_NAME = "https://notify-api-staging.app.cloud.gov/"
|
||||
SECRET_KEY = "dev-notify-secret-key" # nosec B105 - only used in development
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
from flask import jsonify, request
|
||||
from flask_basicauth import BasicAuth
|
||||
|
||||
|
||||
class CustomBasicAuth(BasicAuth):
|
||||
"""
|
||||
Description:
|
||||
Override BasicAuth to permit anonymous healthcheck at /_status?simple=true
|
||||
"""
|
||||
|
||||
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()
|
||||
|
||||
|
||||
custom_basic_auth = CustomBasicAuth()
|
||||
Reference in New Issue
Block a user