mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-07-30 18:27:45 -05:00
added
- document index - api access for thumbnails/downloads - more api filters updated - pipfile removed - filename handling - legacy thumb/download access - obsolete admin gui settings (per page items, FY, inline view)
This commit is contained in:
11
src/paperless/auth.py
Normal file
11
src/paperless/auth.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from rest_framework.authentication import TokenAuthentication
|
||||
|
||||
# This authentication method is required to serve documents and thumbnails for the front end.
|
||||
# https://stackoverflow.com/questions/29433416/token-in-query-string-with-django-rest-frameworks-tokenauthentication
|
||||
class QueryTokenAuthentication(TokenAuthentication):
|
||||
def authenticate(self, request):
|
||||
# Check if 'token_auth' is in the request query params.
|
||||
if 'auth_token' in request.query_params and 'HTTP_AUTHORIZATION' not in request.META:
|
||||
return self.authenticate_credentials(request.query_params.get('auth_token'))
|
||||
else:
|
||||
return None
|
Reference in New Issue
Block a user