X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/6d42bc478e3d1bd90eb294464748c21e4de0fc63..59947fddf28d67c6822267c8a0fc28e13a6e9175:/src/api/drf_auth.py diff --git a/src/api/drf_auth.py b/src/api/drf_auth.py index fa57b41bf..813d9298e 100644 --- a/src/api/drf_auth.py +++ b/src/api/drf_auth.py @@ -1,10 +1,11 @@ -# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later. -# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. +# This file is part of Wolne Lektury, licensed under GNU Affero GPLv3 or later. +# Copyright © Fundacja Wolne Lektury. See NOTICE for more information. # from oauthlib.oauth1 import ResourceEndpoint -from rest_framework.authentication import BaseAuthentication +from rest_framework.authentication import BaseAuthentication, TokenAuthentication from .request_validator import PistonRequestValidator from .utils import oauthlib_request +from .models import Token class PistonOAuthAuthentication(BaseAuthentication): @@ -21,3 +22,7 @@ class PistonOAuthAuthentication(BaseAuthentication): ) if v: return r.token.user, r.token + + +class WLTokenAuthentication(TokenAuthentication): + model = Token