From 16434186dda5e202d7015dc2948f775f08035612 Mon Sep 17 00:00:00 2001 From: mohsentaba Date: Thu, 1 Jan 2026 16:27:58 +0330 Subject: [PATCH] authorization debug --- apps/hadis/views/category.py | 27 +++++++++++++++++++-------- config/settings/base.py | 4 ++-- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/apps/hadis/views/category.py b/apps/hadis/views/category.py index 3ade463..ac2bc80 100644 --- a/apps/hadis/views/category.py +++ b/apps/hadis/views/category.py @@ -300,14 +300,25 @@ class CategoriesBySectView(ListAPIView): def get(self, request, *args, **kwargs): return self.list(request, *args, **kwargs) -from rest_framework.decorators import api_view +from rest_framework.decorators import api_view, permission_classes, authentication_classes +from rest_framework.permissions import AllowAny from rest_framework.response import Response -from rest_framework import status -@api_view(['GET']) +@api_view(['GET', 'POST']) +@permission_classes([AllowAny]) # Let anyone access this +@authentication_classes([]) # Disable auth so we don't get 403 def test_deploy(request): - """ - List all transformers, or create a new transformer - """ - if request.method == 'GET': - return Response('test_deploy') + # This filters all headers Django receives and returns them as JSON + headers = { + k: v for k, v in request.META.items() + if k.startswith('HTTP_') or k == 'CONTENT_TYPE' + } + + # Also check if Authentication settings are actually active + from django.conf import settings + auth_settings = settings.REST_FRAMEWORK.get('DEFAULT_AUTHENTICATION_CLASSES', 'NOT SET') + + return Response({ + "received_headers": headers, + "active_auth_settings": auth_settings + }) \ No newline at end of file diff --git a/config/settings/base.py b/config/settings/base.py index 3e9fd0d..883c813 100644 --- a/config/settings/base.py +++ b/config/settings/base.py @@ -231,8 +231,8 @@ AUTH_PASSWORD_VALIDATORS = [ REST_FRAMEWORK = { - # 'DEFAULT_PAGINATION_CLASS': 'utils.pagination.StandardResultsSetPagination', - # 'PAGE_SIZE': 16, + 'DEFAULT_PAGINATION_CLASS': 'utils.pagination.StandardResultsSetPagination', + 'PAGE_SIZE': 16, # 'DEFAULT_AUTHENTICATION_CLASSES': [ # 'apps.account.auth_back.TokenAuthentication2', # ],