Skip to content

Commit

Permalink
Merge pull request #64 from SELab-2/small_fix
Browse files Browse the repository at this point in the history
Small fix
  • Loading branch information
LGDTimtou authored Mar 14, 2024
2 parents 437e06a + 31ee904 commit 1d86915
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 14 deletions.
7 changes: 0 additions & 7 deletions api/middleware.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from django.conf import settings
from django.shortcuts import redirect
from rest_framework.authentication import SessionAuthentication


class RedirectAnonymousUserMiddleware:
Expand Down Expand Up @@ -31,9 +30,3 @@ def __call__(self, request):
return redirect(settings.LOGIN_URL)

return self.get_response(request)


class CsrfExemptSessionAuthentication(SessionAuthentication):

def enforce_csrf(self, request):
return # To not perform the csrf check previously happening
7 changes: 0 additions & 7 deletions api/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,3 @@

LOGIN_URL = "django_auth_adfs:login"
LOGIN_REDIRECT_URL = "/login_redirect"

REST_FRAMEWORK = {
"DEFAULT_AUTHENTICATION_CLASSES": [
"rest_framework.authentication.BasicAuthentication",
"api.middleware.CsrfExemptSessionAuthentication",
]
}

0 comments on commit 1d86915

Please sign in to comment.