forked from geosolutions-it/geonode-mapstore-client
-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* [Fixes #9377] Improve LOCKDOWN_GEONODE * Improve LOCKDOWN_GEONODE and fix npm build * Fix PR changes * refactor api key param * restore addQueryString function Co-authored-by: allyoucanmap <[email protected]>
- Loading branch information
1 parent
edb5c92
commit c391205
Showing
6 changed files
with
95 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# -*- coding: utf-8 -*- | ||
######################################################################### | ||
# | ||
# Copyright 2015-2022, GeoSolutions Sas. | ||
# All rights reserved. | ||
# | ||
# This source code is licensed under the BSD-style license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
# | ||
######################################################################### | ||
|
||
import logging | ||
from urllib.parse import urlparse | ||
|
||
from django.conf import settings | ||
from geonode.base.auth import extract_user_from_headers, get_auth_token | ||
|
||
from django import template | ||
|
||
logger = logging.getLogger(__name__) | ||
register = template.Library() | ||
|
||
|
||
@register.simple_tag() | ||
def generate_proxyurl(_url, request): | ||
if request: | ||
apikey = request.GET.get('apikey') | ||
if apikey: | ||
pproxyurl = urlparse(_url) | ||
proxyurl = f'{pproxyurl.path}?apikey={apikey}&{pproxyurl.query}' | ||
return proxyurl | ||
return _url | ||
|
||
|
||
@register.simple_tag() | ||
def retrieve_apikey(request): | ||
if settings.ENABLE_APIKEY_LOGIN: | ||
return get_auth_token(request.user) or None |