diff --git a/awx/settings/defaults.py b/awx/settings/defaults.py index 046e6e0570..9684479542 100644 --- a/awx/settings/defaults.py +++ b/awx/settings/defaults.py @@ -242,6 +242,10 @@ AUTH_TOKEN_EXPIRATION = 1800 # -1 is unlimited AUTH_TOKEN_PER_USER = -1 +# Enable / Disable HTTP Basic Authentication used in the API browser +# Note: Session limits are not enforced when using HTTP Basic Authentication. +AUTH_BASIC_ENABLED = True + # If set, serve only minified JS for UI. USE_MINIFIED_JS = False diff --git a/awx/settings/postprocess.py b/awx/settings/postprocess.py index bed4d6299a..a3db97724d 100644 --- a/awx/settings/postprocess.py +++ b/awx/settings/postprocess.py @@ -29,3 +29,7 @@ if not all([SOCIAL_AUTH_SAML_SP_ENTITY_ID, SOCIAL_AUTH_SAML_SP_PUBLIC_CERT, SOCIAL_AUTH_SAML_TECHNICAL_CONTACT, SOCIAL_AUTH_SAML_SUPPORT_CONTACT, SOCIAL_AUTH_SAML_ENABLED_IDPS]): AUTHENTICATION_BACKENDS = [x for x in AUTHENTICATION_BACKENDS if x != 'social.backends.saml.SAMLAuth'] + +if not AUTH_BASIC_ENABLED: + REST_FRAMEWORK['DEFAULT_AUTHENTICATION_CLASSES'] = [x for x in REST_FRAMEWORK['DEFAULT_AUTHENTICATION_CLASSES'] if x != 'rest_framework.authentication.BasicAuthentication'] +