progress on jwt
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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}"
|
||||
)
|
||||
|
||||
@@ -85,6 +85,14 @@
|
||||
"description": "Find out more",
|
||||
"url": "https://www.simbrellang.net"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "AuthorizeRefresh",
|
||||
"description": "This feature will be used for refreshing authorized customers.",
|
||||
"externalDocs": {
|
||||
"description": "Find out more",
|
||||
"url": "https://www.simbrellang.net"
|
||||
}
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
@@ -111,6 +119,9 @@
|
||||
},
|
||||
"/Authorize": {
|
||||
"$ref": "swagger/paths/Authorize.json"
|
||||
},
|
||||
"/AuthorizeRefresh": {
|
||||
"$ref": "swagger/paths/AuthorizeRefresh.json"
|
||||
}
|
||||
},
|
||||
"components": {
|
||||
@@ -156,6 +167,15 @@
|
||||
},
|
||||
"AuthorizeResponse": {
|
||||
"$ref": "swagger/schemas/AuthorizeResponse.json"
|
||||
},
|
||||
"AuthorizeRequest": {
|
||||
"$ref": "swagger/schemas/AuthorizeRequest.json"
|
||||
},
|
||||
"AuthorizeRefreshResponse": {
|
||||
"$ref": "swagger/schemas/AuthorizeRefreshResponse.json"
|
||||
},
|
||||
"AuthorizeRefreshRequest": {
|
||||
"$ref": "swagger/schemas/AuthorizeRefreshRequest.json"
|
||||
}
|
||||
},
|
||||
"securitySchemes": {
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"post": {
|
||||
"tags": ["Authorize Refresh"],
|
||||
"summary": "Customer Authorize Refresh Request",
|
||||
"description": "Customer Authorize Refresh Request",
|
||||
"operationId": "AuthorizeRefresh",
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "../schemas/AuthorizeRefreshRequest.json"
|
||||
}
|
||||
},
|
||||
"application/xml": {
|
||||
"schema": {
|
||||
"$ref": "../schemas/AuthorizeRefreshRequest.json"
|
||||
}
|
||||
},
|
||||
"application/x-www-form-urlencoded": {
|
||||
"schema": {
|
||||
"$ref": "../schemas/AuthorizeRefreshRequest.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Successful operation",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "../schemas/AuthorizeRefreshResponse.json"
|
||||
}
|
||||
},
|
||||
"application/xml": {
|
||||
"schema": {
|
||||
"$ref": "../schemas/AuthorizeRefreshResponse.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Invalid request parameters"
|
||||
},
|
||||
"422": {
|
||||
"description": "Validation exception"
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal server error"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"access_token": {
|
||||
"type": "string",
|
||||
"example": "access_token"
|
||||
}
|
||||
},
|
||||
"xml": {
|
||||
"name": "AuthorizeRefreshRequest"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"resultCode": {
|
||||
"type": "string",
|
||||
"example": "00"
|
||||
},
|
||||
"resultDescription": {
|
||||
"type": "string",
|
||||
"example": "Successful"
|
||||
}
|
||||
},
|
||||
"xml": {
|
||||
"name": "AuthorizeRefreshResponse"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user