mirror of
https://github.com/hubHarmony/servii-backend.git
synced 2024-11-17 21:40:31 +00:00
[V2+] Secrets added.
(For local testing purposes.) [+] Fixed SSL/TLS issues. Signed-off-by: Charles Le Maux <charles.le-maux@epitech.eu>
This commit is contained in:
parent
6cda6461cc
commit
ef6bc53269
9
app.py
9
app.py
@ -39,11 +39,16 @@ def generic_response_maker(status_code: http.HTTPStatus, _message: str = None) -
|
||||
return message, status_code.value
|
||||
|
||||
|
||||
'''
|
||||
valid, user_id = firebase_manager.verify_jwt_token(data['token'])
|
||||
TODO : replace 52 by the given statement.
|
||||
'''
|
||||
|
||||
|
||||
def authenticate_request(data: dict):
|
||||
if 'token' not in data:
|
||||
raise Exception("Missing 'token' in request body. The API doesn't support anonymous access anymore.")
|
||||
else:
|
||||
#valid, user_id = firebase_manager.verify_jwt_token(data['token']) //TODO : REMOVE THIS when the front is ready
|
||||
valid, user_id = True, data['token']
|
||||
if not valid:
|
||||
raise Exception("Invalid JWT token.")
|
||||
@ -95,7 +100,7 @@ def dynamic_route_handler(path):
|
||||
sig = inspect.signature(route_fn)
|
||||
for param in sig.parameters.values():
|
||||
parameters.append(param.name)
|
||||
try :
|
||||
try:
|
||||
mapped_parameters = parse_and_validate_request(parameters)
|
||||
if mapped_parameters is None:
|
||||
return generic_response_maker(http.HTTPStatus.BAD_REQUEST)
|
||||
|
Loading…
Reference in New Issue
Block a user