diff --git a/Dockerfile b/Dockerfile index 7997a57..0906582 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,7 @@ COPY poetry.lock pyproject.toml /app/geoshop_back/ RUN apt update && apt install -y libgdal-dev libffi-dev gettext && \ pip install poetry && \ - poetry install --only=main + poetry install --only=main --no-root COPY . /app/geoshop_back/ diff --git a/default_settings.py b/default_settings.py index c1ad6fe..624e3ca 100644 --- a/default_settings.py +++ b/default_settings.py @@ -285,6 +285,7 @@ FEATURE_FLAGS = { "oidc": os.environ.get("OIDC_ENABLED", "False") == "True", "registration": os.environ.get("REGISTRATION_ENABLED", "True") == "True", + "local_auth": os.environ.get("LOCAL_AUTH_ENABLED", "True") == "True" } AUTHENTICATION_BACKENDS = ("django.contrib.auth.backends.ModelBackend",) diff --git a/urls.py b/urls.py index affe7ee..f249773 100644 --- a/urls.py +++ b/urls.py @@ -79,7 +79,6 @@ path(f'{ROOTURL}extract/orderitem/', views.ExtractOrderItemView.as_view(), name='extract_orderitem'), re_path(rf'^{ROOTURL}extract/orderitem/(?P[0-9]+)$', views.ExtractOrderItemView.as_view(), name='extract_orderitem'), - path(f'{ROOTURL}token/', TokenObtainPairView.as_view(), name='token_obtain_pair'), path(f'{ROOTURL}token/refresh/', TokenRefreshView.as_view(), name='token_refresh'), path(f'{ROOTURL}token/verify/', TokenVerifyView.as_view(), name='token_verify'), path(f'{ROOTURL}session-auth/', include('rest_framework.urls', namespace='rest_framework')), @@ -92,6 +91,12 @@ path(f'{ROOTURL}health/', include('health_check.urls')), ] + static(settings.STATIC_URL,document_root=settings.STATIC_ROOT) + static(settings.MEDIA_URL,document_root=settings.MEDIA_ROOT) +# Hiding Name/Password Token obtain link behind feature flags +if settings.FEATURE_FLAGS["local_auth"]: + urlpatterns += [ + path(f'{ROOTURL}token/', TokenObtainPairView.as_view(), name='token_obtain_pair'), + ] + # OIDC links if OIDC is enabled if settings.FEATURE_FLAGS["oidc"]: urlpatterns += [ @@ -107,3 +112,4 @@ urlpatterns += [ path(f'{ROOTURL}auth/register/', views.RegisterView.as_view(), name='auth_register'), ] +