removed session based authentication and forced token based authentication.
This commit is contained in:
parent
176a4828e7
commit
4783871f84
@ -99,7 +99,7 @@ REST_FRAMEWORK = {
|
|||||||
],
|
],
|
||||||
"DEFAULT_AUTHENTICATION_CLASSES": [
|
"DEFAULT_AUTHENTICATION_CLASSES": [
|
||||||
"knox.auth.TokenAuthentication",
|
"knox.auth.TokenAuthentication",
|
||||||
"rest_framework.authentication.SessionAuthentication"
|
#"rest_framework.authentication.SessionAuthentication"
|
||||||
],
|
],
|
||||||
"DEFAULT_SCHEMA_CLASS": "drf_spectacular.openapi.AutoSchema",
|
"DEFAULT_SCHEMA_CLASS": "drf_spectacular.openapi.AutoSchema",
|
||||||
'DEFAULT_PAGINATION_CLASS': 'settings.puckignation.MediumPagination',
|
'DEFAULT_PAGINATION_CLASS': 'settings.puckignation.MediumPagination',
|
||||||
@ -135,7 +135,7 @@ REST_KNOX = {
|
|||||||
"AUTO_REFRESH": False,
|
"AUTO_REFRESH": False,
|
||||||
"AUTO_REFRESH_MAX_TTL": None,
|
"AUTO_REFRESH_MAX_TTL": None,
|
||||||
"MIN_REFRESH_INTERVAL": 60,
|
"MIN_REFRESH_INTERVAL": 60,
|
||||||
"AUTH_HEADER_PREFIX": "Bearer",
|
"AUTH_HEADER_PREFIX": "PuckoToken",
|
||||||
"EXPIRY_DATETIME_FORMAT": api_settings.DATETIME_FORMAT,
|
"EXPIRY_DATETIME_FORMAT": api_settings.DATETIME_FORMAT,
|
||||||
"TOKEN_MODEL": "knox.AuthToken"
|
"TOKEN_MODEL": "knox.AuthToken"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -94,16 +94,14 @@ class PuckoBase_User(AbstractBaseUser, PermissionsMixin):
|
|||||||
return cls.objects.get(username=username)
|
return cls.objects.get(username=username)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create(cls, username, password, first_name=None, last_name=None, superuser=False):
|
def create(cls, username, password, superuser=False):
|
||||||
if superuser:
|
if superuser:
|
||||||
cls.objects.create_superuser(
|
cls.objects.create_superuser(
|
||||||
username, password=password,
|
username, password=password,
|
||||||
first_name=first_name, last_name=last_name
|
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
cls.objects.create_user(
|
cls.objects.create_user(
|
||||||
username, password=password,
|
username, password=password,
|
||||||
first_name=first_name, last_name=last_name
|
|
||||||
)
|
)
|
||||||
return cls.this(username)
|
return cls.this(username)
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,6 @@ from django.contrib.auth import get_user_model
|
|||||||
from django.contrib.auth import login
|
from django.contrib.auth import login
|
||||||
|
|
||||||
from rest_framework.authtoken.serializers import AuthTokenSerializer
|
from rest_framework.authtoken.serializers import AuthTokenSerializer
|
||||||
from rest_framework.authentication import BasicAuthentication
|
|
||||||
from rest_framework.permissions import AllowAny
|
from rest_framework.permissions import AllowAny
|
||||||
from rest_framework.permissions import IsAuthenticated
|
from rest_framework.permissions import IsAuthenticated
|
||||||
from rest_framework.generics import CreateAPIView
|
from rest_framework.generics import CreateAPIView
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user