fnp
/
wolnelektury.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1a6ad5b
)
Request validation fix.
author
Radek Czajka
<rczajka@rczajka.pl>
Mon, 30 Dec 2019 21:05:56 +0000
(21:05 +0000)
committer
Radek Czajka
<rczajka@rczajka.pl>
Mon, 30 Dec 2019 21:10:01 +0000
(22:10 +0100)
src/api/request_validator.py
patch
|
blob
|
history
diff --git
a/src/api/request_validator.py
b/src/api/request_validator.py
index
690d3e9
..
9a4be2d
100644
(file)
--- a/
src/api/request_validator.py
+++ b/
src/api/request_validator.py
@@
-32,7
+32,17
@@
class PistonRequestValidator(RequestValidator):
return request.token.secret
def get_access_token_secret(self, client_key, token, request):
return request.token.secret
def get_access_token_secret(self, client_key, token, request):
- return request.token.secret
+ if request.token:
+ return request.token.secret
+ else:
+ try:
+ token = Token.objects.get(
+ token_type=Token.ACCESS,
+ consumer__key=client_key,
+ key=token
+ )
+ except: return None
+ return token.secret
def get_default_realms(self, client_key, request):
return ['API']
def get_default_realms(self, client_key, request):
return ['API']