api: add token authentication

This commit is contained in:
Jens Langhammer
2020-07-05 23:15:07 +02:00
parent d5a3e09a98
commit 2e2c9f5287
5 changed files with 57 additions and 11 deletions

View File

@ -118,6 +118,9 @@ GUARDIAN_MONKEY_PATCH = False
SWAGGER_SETTINGS = {
"DEFAULT_INFO": "passbook.api.v2.urls.info",
"SECURITY_DEFINITIONS": {
"token": {"type": "apiKey", "name": "Authorization", "in": "header"}
},
}
REST_FRAMEWORK = {
@ -128,13 +131,10 @@ REST_FRAMEWORK = {
"rest_framework.filters.OrderingFilter",
"rest_framework.filters.SearchFilter",
],
"DEFAULT_PERMISSION_CLASSES": (
# 'rest_framework.permissions.IsAuthenticated',
"passbook.api.permissions.CustomObjectPermissions",
),
"DEFAULT_PERMISSION_CLASSES": ("passbook.api.permissions.CustomObjectPermissions"),
"DEFAULT_AUTHENTICATION_CLASSES": (
"passbook.api.auth.PassbookTokenAuthentication",
"rest_framework.authentication.SessionAuthentication",
# 'rest_framework_jwt.authentication.JSONWebTokenAuthentication',
),
}