progress on JWT

This commit is contained in:
lennyaiko
2025-04-03 17:54:29 +01:00
parent ec2ec07d60
commit a5f3119cdc
4 changed files with 23 additions and 8 deletions
+10 -1
View File
@@ -12,6 +12,14 @@ from app.api.services import (
from app.utils.logger import logger
from app.api.middlewares import enforce_json, require_auth
import os
from flask_jwt_extended import (
JWTManager,
jwt_required,
create_access_token,
get_jwt_identity,
create_refresh_token,
jwt_refresh_token_required,
)
api = Blueprint("api", __name__)
@@ -123,8 +131,9 @@ def authorize():
# Authorize refresh endpoint
@api.route("/AuthorizeRefresh", methods=["POST"])
@jwt_refresh_token_required
def refresh():
data = request.get_json()
# logger.info(f"Authorize refresh request received: {data}")
response = AuthorizationService.process_refresh_request(data)
response = AuthorizationService.process_refresh_request()
return response
+5
View File
@@ -1,4 +1,5 @@
import os
from datetime import timedelta
class Config:
@@ -24,6 +25,10 @@ class Config:
SIMBRELLA_BASE_URL = os.getenv("SIMBRELLA_BASE_URL", "http://127.0.0.1:6337")
JWT_SECRET_KEY = os.getenv("JWT_SECRET_KEY", "secret-key")
JWT_ACCESS_TOKEN_EXPIRES = os.getenv("JWT_ACCESS_TOKEN_EXPIRES", timedelta(hours=1))
JWT_REFRESH_TOKEN_EXPIRES = os.getenv(
"JWT_REFRESH_TOKEN_EXPIRES", timedelta(days=30)
)
settings = Config()
+7 -1
View File
@@ -182,12 +182,18 @@
"basicAuth": {
"type": "http",
"scheme": "basic"
},
"bearerAuth": {
"type": "http",
"scheme": "bearer",
"bearerFormat": "JWT"
}
}
},
"security": [
{
"basicAuth": []
"basicAuth": [],
"bearerAuth": []
}
]
}
@@ -1,11 +1,6 @@
{
"type": "object",
"properties": {
"access_token": {
"type": "string",
"example": "access_token"
}
},
"properties": {},
"xml": {
"name": "AuthorizeRefreshRequest"
}