Skip to content

Commit 0483ae6

Browse files
authored
PR for #329 optional basic auth disable (#330)
* #293 fix: remove ESRI headers before populating auth headers * #329 optionally disable basic auth with GHC_BASIC_AUTH_DISABLE * #329 commit to trigger travis
1 parent 8d207e5 commit 0483ae6

File tree

5 files changed

+10
-1
lines changed

5 files changed

+10
-1
lines changed

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ ENV LC_ALL="en_US.UTF-8" \
3232
GHC_ADMIN_EMAIL='[email protected]' \
3333
GHC_RUNNER_IN_WEBAPP=False \
3434
GHC_REQUIRE_WEBAPP_AUTH=False \
35+
GHC_BASIC_AUTH_DISABLED=False \
3536
GHC_LOG_LEVEL=30 \
3637
GHC_LOG_FORMAT='%(asctime)s - %(name)s - %(levelname)s - %(message)s' \
3738
GHC_NOTIFICATIONS_EMAIL='[email protected],[email protected]' \

GeoHealthCheck/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def load_user_from_request(request):
158158
# Inspiration: https://flask-login.readthedocs.io
159159
# /en/latest/#custom-login-using-request-loader
160160
basic_auth_val = request.headers.get('Authorization')
161-
if basic_auth_val:
161+
if basic_auth_val and CONFIG['GHC_BASIC_AUTH_DISABLED'] is False:
162162
basic_auth_val = basic_auth_val.replace('Basic ', '', 1)
163163
authenticated = False
164164
try:

GeoHealthCheck/config_main.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
GHC_SITE_URL = 'http://host'
5151
GHC_RUNNER_IN_WEBAPP = True
5252
GHC_REQUIRE_WEBAPP_AUTH = False
53+
GHC_BASIC_AUTH_DISABLED = False
5354
# 10=DEBUG 20=INFO 30=WARN(ING) 40=ERROR 50=FATAL/CRITICAL
5455
GHC_LOG_LEVEL = 30
5556
GHC_LOG_FORMAT = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'

docker/config_site.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def str2bool(v):
5757
GHC_SITE_URL = os.environ['GHC_SITE_URL']
5858
GHC_RUNNER_IN_WEBAPP = str2bool(os.environ['GHC_RUNNER_IN_WEBAPP'])
5959
GHC_REQUIRE_WEBAPP_AUTH = str2bool(os.environ['GHC_REQUIRE_WEBAPP_AUTH'])
60+
GHC_BASIC_AUTH_DISABLED = str2bool(os.environ['GHC_BASIC_AUTH_DISABLED'])
6061
GHC_LOG_LEVEL = int(os.environ['GHC_LOG_LEVEL'])
6162
GHC_LOG_FORMAT = os.environ['GHC_LOG_FORMAT']
6263

docs/config.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ The configuration options are:
3333
- **GHC_PROBE_DEFAULTS**: Default `Probe` class to assign on "add" per Resource-type
3434
- **GHC_METADATA_CACHE_SECS**: metadata, "Capabilities Docs", cache expiry time, default 900 secs, -1 to disable
3535
- **GHC_REQUIRE_WEBAPP_AUTH**: require authentication (login or Basic Auth) to access GHC webapp and APIs (default: ``False``)
36+
- **GHC_BASIC_AUTH_DISABLED**: disable Basic Authentication to access GHC webapp and APIs (default: ``False``), see below when to set to `True`
3637
- **GHC_RUNNER_IN_WEBAPP**: should the GHC Runner Daemon be run in webapp (default: ``True``), more below
3738
- **GHC_LOG_LEVEL**: logging level: 10=DEBUG 20=INFO 30=WARN(ING) 40=ERROR 50=FATAL/CRITICAL (default: 30, WARNING)
3839
- **GHC_MAP**: default map settings
@@ -201,3 +202,8 @@ the login screen. Initially only the ``admin`` user will be able to login, but i
201202
and allow additional users by registering these within the ``admin`` login session.
202203
Note that password reset is still enabled. For remote REST API calls standard HTTP Basic
203204
Authentication (via the HTTP `Authentication` request header) can be used.
205+
206+
In some cases where an external web- or proxy server provides HTTP Basic Authentication, a conflict may
207+
arise when GHC also checks the `Authorization` HTTP header used for the external Basic Auth. In those
208+
cases GHC Basic Auth checking can be disabled using the **GHC_BASIC_AUTH_DISABLED** to `True`.
209+
TODO: provide API Token auth to allow both external Basic Auth and GHC API auth.

0 commit comments

Comments
 (0)