debian: do not load APIClientAuthentication in authentic (#69296)
gitea-wip/hobo/pipeline/head There was a failure building this commit Details
gitea/hobo/pipeline/head Something is wrong with the build of this commit Details

This commit is contained in:
Emmanuel Cazenave 2022-09-20 12:27:44 +02:00
parent 20dcea566c
commit 22c8c2cb89
1 changed files with 8 additions and 5 deletions

View File

@ -393,14 +393,17 @@ BROKER_TASK_EXPIRES = 600
STATICS_HASH_COUNTER = '/var/lib/publik/statics-counter'
# Django Rest Framework: allow only Publik-signed URLs
# Django Rest Framework: allow Publik-signed URLs and APIClient
if 'rest_framework' in INSTALLED_APPS:
if 'REST_FRAMEWORK' not in globals():
REST_FRAMEWORK = {}
REST_FRAMEWORK['DEFAULT_AUTHENTICATION_CLASSES'] = (
'hobo.rest_authentication.PublikAuthentication',
'hobo.rest_authentication.APIClientAuthentication',
)
if 'authentic2' not in INSTALLED_APPS:
REST_FRAMEWORK['DEFAULT_AUTHENTICATION_CLASSES'] = (
'hobo.rest_authentication.PublikAuthentication',
'hobo.rest_authentication.APIClientAuthentication',
)
else:
REST_FRAMEWORK['DEFAULT_AUTHENTICATION_CLASSES'] = ('hobo.rest_authentication.PublikAuthentication',)
REST_FRAMEWORK['DEFAULT_PERMISSION_CLASSES'] = ('rest_framework.permissions.IsAuthenticated',)
REST_FRAMEWORK['DEFAULT_RENDERER_CLASSES'] = ('rest_framework.renderers.JSONRenderer',)