Skip to content

Commit

Permalink
[Fixes #4168] GeoNode Proxy should be using OAUTH2 Bearer Header now
Browse files Browse the repository at this point in the history
  • Loading branch information
afabiani committed Jan 23, 2019
1 parent 0bdfa39 commit cf1b78c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 10 deletions.
2 changes: 1 addition & 1 deletion geonode/local_settings.py.geoserver.sample
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ GEOSERVER_PUBLIC_PORT = os.getenv(
'GEOSERVER_PUBLIC_PORT', 8080
)

_default_public_location = 'http://{}:{}/geoserver/'.format(GEOSERVER_PUBLIC_HOST, GEOSERVER_PUBLIC_PORT) if GEOSERVER_PUBLIC_PORT else 'http://{}/geoserver/'.format(GEOSERVER_PUBLIC_HOST)
_default_public_location = 'http://{}:{}/gs/'.format(GEOSERVER_PUBLIC_HOST, GEOSERVER_PUBLIC_PORT) if GEOSERVER_PUBLIC_PORT else 'http://{}/gs/'.format(GEOSERVER_PUBLIC_HOST)

GEOSERVER_PUBLIC_LOCATION = os.getenv(
'GEOSERVER_PUBLIC_LOCATION', _default_public_location
Expand Down
8 changes: 1 addition & 7 deletions geonode/proxy/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,7 @@ def proxy(request, url=None, response_callback=None,
if auth:
headers['Authorization'] = auth
elif access_token:
# TODO: Bearer is currently cutted of by Djano / GeoServer
if request.method in ("POST", "PUT", "DELETE"):
headers['Authorization'] = 'Bearer %s' % access_token
if 'access_token' not in locator:
query_separator = '&' if '?' in locator else '?'
locator = ('%s%saccess_token=%s' %
(locator, query_separator, access_token))
headers['Authorization'] = 'Bearer %s' % access_token

site_url = urlsplit(settings.SITEURL)

Expand Down
3 changes: 1 addition & 2 deletions geonode/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -744,8 +744,7 @@
)

GEOSERVER_PUBLIC_LOCATION = os.getenv(
# 'GEOSERVER_PUBLIC_LOCATION', urljoin(SITEURL, '/geoserver')
'GEOSERVER_PUBLIC_LOCATION', GEOSERVER_LOCATION
'GEOSERVER_PUBLIC_LOCATION', urljoin(SITEURL, '/gs/')
)

OGC_SERVER_DEFAULT_USER = os.getenv(
Expand Down

0 comments on commit cf1b78c

Please sign in to comment.