Skip to content

Commit

Permalink
Updated Django to 4.2 LTS and testing session authentication to routes
Browse files Browse the repository at this point in the history
  • Loading branch information
MitchellAV committed May 25, 2024
1 parent abd9b07 commit 672bbfd
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 9 deletions.
7 changes: 5 additions & 2 deletions valhub/analyses/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@
permission_classes,
)
from rest_framework.permissions import IsAuthenticated
from rest_framework.authentication import TokenAuthentication
from rest_framework.authentication import (
TokenAuthentication,
SessionAuthentication,
)


logger = logging.getLogger(__name__)
Expand All @@ -38,7 +41,7 @@

@api_view(["GET"])
@csrf_exempt
@authentication_classes([TokenAuthentication])
@authentication_classes([SessionAuthentication, TokenAuthentication])
@permission_classes([IsAuthenticated])
def list_analysis(request):
analyses = Analysis.objects.all()
Expand Down
8 changes: 6 additions & 2 deletions valhub/error_report/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@

urlpatterns = [
path("error_report", views.ErrorReport, name="error_report"),
path("error_report/list", views.ErrorReportList, name="error_report_list"),
path(
"error_report/list",
views.ErrorReportList.as_view(),
name="error_report_list",
),
path("error_report/new", views.ErrorReportNew, name="error_report_new"),
path(
"error_report/<int:pk>",
views.ErrorReportDetail,
views.ErrorReportDetail.as_view(),
name="error_report_detail",
),
path(
Expand Down
10 changes: 5 additions & 5 deletions valhub/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
Django==3.2.16
Django==4.2
mysqlclient==2.1.1
boto3==1.26.16
requests==2.28.1
djangorestframework==3.14.0
django-cors-headers==3.13.0
boto3
requests
djangorestframework
django-cors-headers
psycopg2-binary
psycopg2
django-storages[boto3]
Expand Down
7 changes: 7 additions & 0 deletions valhub/valhub/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,13 @@ def get_secret(secret_name):
"whitenoise.middleware.WhiteNoiseMiddleware",
]

REST_FRAMEWORK = {
"DEFAULT_AUTHENTICATION_CLASSES": [
"rest_framework.authentication.TokenAuthentication",
"rest_framework.authentication.SessionAuthentication",
],
}

CORS_ORIGIN_ALLOW_ALL = True
# CORS_ALLOWED_ORIGINS = [
# "https://domain.com",
Expand Down

0 comments on commit 672bbfd

Please sign in to comment.