diff --git a/appunti/settings.py b/appunti/settings.py index 06aa77c..98dde61 100644 --- a/appunti/settings.py +++ b/appunti/settings.py @@ -38,6 +38,7 @@ INSTALLED_APPS = [ "django.contrib.messages", "django.contrib.staticfiles", "rest_framework", + "knox", "notes", "livereload", ] @@ -132,6 +133,15 @@ REST_FRAMEWORK = { "DEFAULT_PERMISSION_CLASSES": [ "rest_framework.permissions.IsAuthenticated", ], + "DEFAULT_AUTHENTICATION_CLASSES": [ + "knox.auth.TokenAuthentication", + "rest_framework.authentication.BasicAuthentication", + "rest_framework.authentication.SessionAuthentication", + ], +} + +REST_KNOX = { + "TOKEN_TTL": None, } LOGIN_URL = "login" diff --git a/notes/static/notes/images/icons/paw.png b/notes/static/notes/images/icons/paw.png new file mode 100644 index 0000000..d57bbbc Binary files /dev/null and b/notes/static/notes/images/icons/paw.png differ diff --git a/pyproject.toml b/pyproject.toml index 8bc36ed..3076ec4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,6 +6,7 @@ readme = "README.md" requires-python = ">=3.13" dependencies = [ "django>=5.2.8", + "django-rest-knox>=5.0.2", "djangorestframework>=3.16.1", ] diff --git a/uv.lock b/uv.lock index 20afbc1..bc71f0e 100644 --- a/uv.lock +++ b/uv.lock @@ -8,6 +8,7 @@ version = "0.1.0" source = { virtual = "." } dependencies = [ { name = "django" }, + { name = "django-rest-knox" }, { name = "djangorestframework" }, ] @@ -22,6 +23,7 @@ dev = [ [package.metadata] requires-dist = [ { name = "django", specifier = ">=5.2.8" }, + { name = "django-rest-knox", specifier = ">=5.0.2" }, { name = "djangorestframework", specifier = ">=3.16.1" }, ] @@ -114,6 +116,19 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/8c/cd/77566526193cb49e805bd33a6b982ba5a39f3a7f828dd6647a76bf977f3c/django_livereload_server-0.5.1-py2.py3-none-any.whl", hash = "sha256:e03bd65d1679ef1b4a5e22e2a77d11d3cfb0e3d21ae25afba49e280924ba6f58", size = 25920, upload-time = "2023-12-19T23:22:00.494Z" }, ] +[[package]] +name = "django-rest-knox" +version = "5.0.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "django" }, + { name = "djangorestframework" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/ba/7e/6ef520fbfa0cb902fe32c6f921426b1dcfa50cb2471a0ddca31ba770fa72/django_rest_knox-5.0.2.tar.gz", hash = "sha256:f283622bcf5d28a6a0203845c065d06c7432efa54399ae32070c61ac03af2d6f", size = 16292, upload-time = "2024-09-30T21:21:07.606Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/13/29/09468c086fd19f34b00a9698ee9cc1864dfae8c171be140657b965577472/django_rest_knox-5.0.2-py3-none-any.whl", hash = "sha256:694da5d0ad6eb3edbfd7cdc8d69c089fc074e6b0e548e00ff2750bf2fdfadb6f", size = 14960, upload-time = "2024-09-30T21:21:04.896Z" }, +] + [[package]] name = "django-stubs" version = "5.2.8"