fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Responsive images.
[wolnelektury.git]
/
src
/
api
/
drf_auth.py
diff --git
a/src/api/drf_auth.py
b/src/api/drf_auth.py
index
ca6a491
..
fa57b41
100644
(file)
--- a/
src/api/drf_auth.py
+++ b/
src/api/drf_auth.py
@@
-1,10
+1,10
@@
-# -*- coding: utf-8 -*-
# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
from oauthlib.oauth1 import ResourceEndpoint
from rest_framework.authentication import BaseAuthentication
from .request_validator import PistonRequestValidator
# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
from oauthlib.oauth1 import ResourceEndpoint
from rest_framework.authentication import BaseAuthentication
from .request_validator import PistonRequestValidator
+from .utils import oauthlib_request
class PistonOAuthAuthentication(BaseAuthentication):
class PistonOAuthAuthentication(BaseAuthentication):
@@
-17,13
+17,7
@@
class PistonOAuthAuthentication(BaseAuthentication):
def authenticate(self, request):
v, r = self.provider.validate_protected_resource_request(
def authenticate(self, request):
v, r = self.provider.validate_protected_resource_request(
- request.build_absolute_uri(),
- http_method=request.method,
- body=request.body,
- headers={
- "Authorization": request.META['HTTP_AUTHORIZATION'],
- "Content-Type": request.content_type,
- } if 'HTTP_AUTHORIZATION' in request.META else None
+ **oauthlib_request(request)
)
if v:
return r.token.user, r.token
)
if v:
return r.token.user, r.token