Update JWT to not expire for nodes and expire in 1 hour for users
All checks were successful
release-image / release-image (push) Successful in 2m12s

This commit is contained in:
Logan Cusano
2025-06-29 01:43:09 -04:00
parent e89e67f33a
commit 7820e87989
2 changed files with 3 additions and 2 deletions

View File

@@ -5,6 +5,7 @@ from quart_jwt_extended import create_access_token, jwt_required, get_jwt_identi
from internal.auth_wrappers import UserDbController
from internal.types import UserRoles
from uuid import uuid4
from datetime import timedelta
# Import the centralized JWTManager instance
from config.jwt_config import jwt as jwt_manager_instance # Renamed to avoid confusion with jwt_required
@@ -97,7 +98,7 @@ async def login_user():
if not user or not check_password_hash(user.password_hash, password):
abort(401, "Invalid credentials")
access_token = create_access_token(identity={"id": user._id, "username": user.username, "type": "user"})
access_token = create_access_token(identity={"id": user._id, "username": user.username, "type": "user"}, expires_delta=timedelta(hours=1))
return jsonify({"access_token": access_token, "role": user.role, "username": user.username, "user_id": user._id }), 200
# DEPRECATED

View File

@@ -24,7 +24,7 @@ async def register_client(websocket, client_id, client_nickname):
print(f"Client {client_id} connected.")
# Create a JWT for the client
current_app.active_clients[client_id].access_token = create_access_token(identity={"id": client_id, "username": client_nickname, "type": "node"})
current_app.active_clients[client_id].access_token = create_access_token(identity={"id": client_id, "username": client_nickname, "type": "node"}, expires_delta=False)
print(current_app.active_clients[client_id])