removed session based authentication and forced token based authentication.

This commit is contained in:
puckoprutt 2025-02-22 13:05:41 +01:00
parent 176a4828e7
commit 4783871f84
3 changed files with 3 additions and 6 deletions

View File

@ -99,7 +99,7 @@ REST_FRAMEWORK = {
],
"DEFAULT_AUTHENTICATION_CLASSES": [
"knox.auth.TokenAuthentication",
"rest_framework.authentication.SessionAuthentication"
#"rest_framework.authentication.SessionAuthentication"
],
"DEFAULT_SCHEMA_CLASS": "drf_spectacular.openapi.AutoSchema",
'DEFAULT_PAGINATION_CLASS': 'settings.puckignation.MediumPagination',
@ -135,7 +135,7 @@ REST_KNOX = {
"AUTO_REFRESH": False,
"AUTO_REFRESH_MAX_TTL": None,
"MIN_REFRESH_INTERVAL": 60,
"AUTH_HEADER_PREFIX": "Bearer",
"AUTH_HEADER_PREFIX": "PuckoToken",
"EXPIRY_DATETIME_FORMAT": api_settings.DATETIME_FORMAT,
"TOKEN_MODEL": "knox.AuthToken"
}

View File

@ -94,16 +94,14 @@ class PuckoBase_User(AbstractBaseUser, PermissionsMixin):
return cls.objects.get(username=username)
@classmethod
def create(cls, username, password, first_name=None, last_name=None, superuser=False):
def create(cls, username, password, superuser=False):
if superuser:
cls.objects.create_superuser(
username, password=password,
first_name=first_name, last_name=last_name
)
else:
cls.objects.create_user(
username, password=password,
first_name=first_name, last_name=last_name
)
return cls.this(username)

View File

@ -2,7 +2,6 @@ from django.contrib.auth import get_user_model
from django.contrib.auth import login
from rest_framework.authtoken.serializers import AuthTokenSerializer
from rest_framework.authentication import BasicAuthentication
from rest_framework.permissions import AllowAny
from rest_framework.permissions import IsAuthenticated
from rest_framework.generics import CreateAPIView