progress on jwt

This commit is contained in:
lennyaiko
2025-04-03 17:41:07 +01:00
parent 362f31c100
commit 76fc959e2e
6 changed files with 144 additions and 1 deletions
+9
View File
@@ -119,3 +119,12 @@ def authorize():
# logger.info(f"Authorize request received: {data}")
response = AuthorizationService.process_request(data)
return response
# Authorize refresh endpoint
@api.route("/AuthorizeRefresh", methods=["POST"])
def refresh():
data = request.get_json()
# logger.info(f"Authorize refresh request received: {data}")
response = AuthorizationService.process_refresh_request(data)
return response
+33 -1
View File
@@ -29,7 +29,7 @@ class AuthorizationService(BaseService):
try:
logger.info("Processing Authorization request")
if not request.is_json:
if not data:
return ResponseHelper.bad_request(message="Missing JSON in request")
# Validate input data using the Authorization schema
@@ -66,3 +66,35 @@ class AuthorizationService(BaseService):
return ResponseHelper.internal_server_error(
message=f"Error processing Authorization request: {e}"
)
@staticmethod
def process_refresh_request():
"""
Process the RefreshToken request.
Args:
data (dict): The request data.
Returns:
dict: A standardized response.
"""
try:
logger.info("Processing RefreshToken request")
identity = get_jwt_identity()
access_token = create_access_token(identity=identity)
# Simulated processing logic
response_data = {
"access_token": access_token,
}
return ResponseHelper.success(
data=response_data, message="RefreshToken processed successfully"
)
except Exception as e:
logger.error(f"Error processing RefreshToken request: {e}")
return ResponseHelper.internal_server_error(
message=f"Error processing RefreshToken request: {e}"
)