Commit afa6e56f authored by Sofia Papagiannaki's avatar Sofia Papagiannaki

pithos: Rename setting

Change PITHOS_SERVE_API_DOMAIN to PITHOS_UNSAFE_DOMAIN
parent f2b84903
......@@ -279,7 +279,7 @@ Pithos
* Add PITHOS_OAUTH2_CLIENT_CREDENTIALS setting to authenticate the views with
astakos during the resource access token generation procedure
* Add PITHOS_SERVE_API_DOMAIN setting to restrict file serving endpoints to a
* Add PITHOS_UNSAFE_DOMAIN setting to restrict file serving endpoints to a
specific host
* Management commands:
......
......@@ -233,7 +233,7 @@ By default it is set to 30 characters.
Restrict file serving endpoints to a specific host
--------------------------------------------------
A new setting ``PITHOS_SERVE_API_DOMAIN`` has been introduced. When set,
A new setting ``PITHOS_UNSAFE_DOMAIN`` has been introduced. When set,
all api views that serve pithos file contents will be restricted to be served
only under the domain specified in the setting value.
......
......@@ -61,4 +61,4 @@
#
# Set domain to restrict requests of pithos object contents serve endpoint or
# None for no domain restriction
#PITHOS_SERVE_API_DOMAIN = None
#PITHOS_UNSAFE_DOMAIN = None
......@@ -37,7 +37,7 @@ from django.views.decorators.csrf import csrf_exempt
from snf_django.lib import api
from snf_django.lib.api import faults
from pithos.api.settings import SERVE_API_DOMAIN
from pithos.api.settings import UNSAFE_DOMAIN
from pithos.api.util import (put_object_headers, update_manifest_meta,
validate_modification_preconditions,
validate_matching_preconditions,
......@@ -49,7 +49,7 @@ logger = logging.getLogger(__name__)
@csrf_exempt
@restrict_to_host(SERVE_API_DOMAIN)
@restrict_to_host(UNSAFE_DOMAIN)
def public_demux(request, v_public):
if request.method == 'HEAD':
return public_meta(request, v_public)
......
......@@ -190,4 +190,4 @@ OAUTH2_CLIENT_CREDENTIALS = getattr(settings,
# Set domain to restrict requests of pithos object contents serve endpoint or
# None for no domain restriction
SERVE_API_DOMAIN = getattr(settings, 'PITHOS_SERVE_API_DOMAIN', None)
UNSAFE_DOMAIN = getattr(settings, 'PITHOS_UNSAFE_DOMAIN', None)
......@@ -67,7 +67,7 @@ from pithos.api.settings import (BACKEND_DB_MODULE, BACKEND_DB_CONNECTION,
RADOS_POOL_MAPS, TRANSLATE_UUIDS,
PUBLIC_URL_SECURITY, PUBLIC_URL_ALPHABET,
BASE_HOST, UPDATE_MD5, VIEW_PREFIX,
OAUTH2_CLIENT_CREDENTIALS, SERVE_API_DOMAIN)
OAUTH2_CLIENT_CREDENTIALS, UNSAFE_DOMAIN)
from pithos.api.resources import resources
from pithos.backends import connect_backend
......@@ -1165,7 +1165,7 @@ def view_method():
"""Decorator function for views."""
def decorator(func):
@restrict_to_host(SERVE_API_DOMAIN)
@restrict_to_host(UNSAFE_DOMAIN)
@wraps(func)
def wrapper(request, *args, **kwargs):
if request.method not in ['GET', 'HEAD']:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment