Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 3 additions & 25 deletions gateway/main/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import os
import os.path
import sys
from datetime import timedelta
from pathlib import Path
from utils import sanitize_file_path

Expand Down Expand Up @@ -71,9 +70,6 @@
"django_prometheus",
"rest_framework",
"rest_framework.authtoken",
"rest_framework_simplejwt",
"allauth",
"allauth.socialaccount",
"api",
"psycopg2",
"drf_yasg",
Expand Down Expand Up @@ -200,8 +196,7 @@
]

AUTHENTICATION_BACKENDS = [
# `allauth` specific authentication methods, such as login by e-mail
"allauth.account.auth_backends.AuthenticationBackend",
"django.contrib.auth.backends.ModelBackend",
]

# Internationalization
Expand Down Expand Up @@ -233,13 +228,8 @@
# =============
# AUTH SETTINGS
# =============
SETTINGS_AUTH_MECHANISM = os.environ.get("SETTINGS_AUTH_MECHANISM", "default")
SETTINGS_DEFAULT_AUTH_CLASSES = [
"rest_framework_simplejwt.authentication.JWTAuthentication",
"dj_rest_auth.jwt_auth.JWTCookieAuthentication",
]
SETTINGS_AUTH_MECHANISM = os.environ.get("SETTINGS_AUTH_MECHANISM", "custom_token")
ALL_AUTH_CLASSES_CONFIGURATION = {
"default": SETTINGS_DEFAULT_AUTH_CLASSES,
"custom_token": [
"api.authentication.CustomTokenBackend",
],
Expand All @@ -248,7 +238,7 @@
],
}
DJR_DEFAULT_AUTHENTICATION_CLASSES = ALL_AUTH_CLASSES_CONFIGURATION.get(
SETTINGS_AUTH_MECHANISM, SETTINGS_DEFAULT_AUTH_CLASSES
SETTINGS_AUTH_MECHANISM, ["api.authentication.CustomTokenBackend"]
)
# mock token value
SETTINGS_AUTH_MOCK_TOKEN = os.environ.get("SETTINGS_AUTH_MOCK_TOKEN", "awesome_token")
Expand All @@ -268,12 +258,6 @@
"PAGE_SIZE": 100,
}

REST_AUTH = {
"USE_JWT": True,
# 'JWT_AUTH_COOKIE': 'gateway-app-auth',
# 'JWT_AUTH_REFRESH_COOKIE': 'gateway-refresh-token',
}

SWAGGER_SETTINGS = {
"SECURITY_DEFINITIONS": {
"Bearer Token": {
Expand All @@ -288,12 +272,6 @@
SITE_ID = 1
SITE_HOST = os.environ.get("SITE_HOST", "http://localhost:8000")

# Provider specific settings
SIMPLE_JWT = {
"ACCESS_TOKEN_LIFETIME": timedelta(days=10),
"REFRESH_TOKEN_LIFETIME": timedelta(days=20),
}

# custom token auth
QUANTUM_PLATFORM_API_BASE_URL = os.environ.get("QUANTUM_PLATFORM_API_BASE_URL", None)
# verification fields to check when returned from auth api
Expand Down
3 changes: 0 additions & 3 deletions gateway/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
cryptography>=44.0.3, <45
djangorestframework>=3.15.2, <4
django-allauth[socialaccount]>=65.7.0, <66
django-allow-cidr>=0.7.1, <1
dj-rest-auth>=7.0.0, <8
django-csp>=3.8, <4
djangorestframework-simplejwt>=5.3.1, <6
django_prometheus>=2.3.1, <3
ray[default]>=2.30.0, <3
Django>=5.2.1, <6
Expand Down
1 change: 0 additions & 1 deletion gateway/tests/api/management/test_commands.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Tests for commands."""

from datetime import datetime
from allauth.socialaccount.models import SocialApp
from django.core.management import call_command
from ray.dashboard.modules.job.common import JobStatus
from rest_framework.test import APITestCase
Expand Down
Loading