Skip to content

Commit

Permalink
jwt in params
Browse files Browse the repository at this point in the history
  • Loading branch information
SkywalkerSpace committed Aug 28, 2020
1 parent a1097ec commit d2f1ce1
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 14 deletions.
3 changes: 3 additions & 0 deletions default
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ server {
access_log /var/log/nginx/thumbnail.access.log;
error_log /var/log/nginx/thumbnail.error.log;

client_header_buffer_size 2k
large_client_header_buffers 4 4k/8k

location / {
proxy_pass http://localhost:8088;
# proxy_pass http://unix:/var/run/thumbnail.sock;
Expand Down
1 change: 0 additions & 1 deletion seatable_thumbnail/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


# jwt
JWT_AUTH_HEADER_PREFIX = 'JWT '
JWT_ALGORITHM = 'HS256'
JWT_VERIFY = True
JWT_LEEWAY = 0
Expand Down
10 changes: 0 additions & 10 deletions seatable_thumbnail/http_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,9 @@ def __init__(self, **scope):
self.parse()

def parse(self):
self.parse_headers()
self.parse_url()
self.parse_query_dict()

def parse_headers(self):
raw_headers = self.headers
headers = {}
for item in raw_headers:
k = item[0].decode().lower()
v = item[1].decode()
headers[k] = v
self.headers = headers

def parse_url(self):
self.url = self.path[len(settings.URL_PREFIX):]

Expand Down
5 changes: 2 additions & 3 deletions seatable_thumbnail/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from seaserv import seafile_api
import seatable_thumbnail.settings as settings
from seatable_thumbnail.constants import FILE_EXT_TYPE_MAP, JWT_AUTH_HEADER_PREFIX, \
from seatable_thumbnail.constants import FILE_EXT_TYPE_MAP, \
JWT_VERIFY, JWT_LEEWAY, JWT_AUDIENCE, JWT_ISSUER, JWT_ALGORITHM, \
IMAGE, PSD, VIDEO, XMIND

Expand Down Expand Up @@ -44,8 +44,7 @@ def jwt_decode_handler(self, jwt_token):
)

def jwt_check(self):
jwt_token = self.request.headers['authorization'][
len(JWT_AUTH_HEADER_PREFIX):]
jwt_token = self.request.query_dict['token'][0]
self.payload = self.jwt_decode_handler(jwt_token)

# permission check
Expand Down

0 comments on commit d2f1ce1

Please sign in to comment.