Skip to content
Snippets Groups Projects
Commit ed872cf1 authored by Nico Vermaas's avatar Nico Vermaas
Browse files

added SessionAuthentication for the REST API

parent 0fcf79d2
No related branches found
No related tags found
2 merge requests!213Master,!212added SessionAuthentication for the REST API
......@@ -74,6 +74,7 @@ REST_FRAMEWORK = {
'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly'
],
'DEFAULT_AUTHENTICATION_CLASSES': [
'rest_framework.authentication.SessionAuthentication',
'rest_framework.authentication.TokenAuthentication',
],
'DEFAULT_FILTER_BACKENDS': (
......
......@@ -34,7 +34,7 @@
{% include 'taskdatabase/pagination.html' %}
</div>
</div>
<p class="footer"> Version 1.0.0 (4 mar 2021 - 15:00)
<p class="footer"> Version 1.0.0 (8 mar 2021 - 17:00)
</div>
......
from django.urls import include, path
from django.contrib.auth import views as auth_views
from rest_framework.authtoken import views as rest_auth_views
from . import views
......@@ -36,6 +37,9 @@ urlpatterns = [
path('config/', views.ShowConfig, name='config'),
# --- REST API ---
path('obtain-auth-token/', rest_auth_views.obtain_auth_token),
path('tasks/', views.TaskListViewAPI.as_view(), name='tasks-api'),
path('tasks/<int:pk>/', views.TaskDetailsViewAPI.as_view(), name='task-detail-view-api'),
path('tasks-fast/', views.TaskListViewAPIFast.as_view(), name='tasks-api-fast'),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment