From ba96d7a8b4ebec20222a9a3cf3ed083a0c37637c Mon Sep 17 00:00:00 2001 From: Azeez Muibi Date: Tue, 15 Apr 2025 16:56:37 +0100 Subject: [PATCH] update --- app/config.py | 3 ++ app/swagger/paths/Login.json | 42 ++++++++++++++++++++++++++ app/swagger/schemas/LoginRequest.json | 14 +++++++++ app/swagger/schemas/LoginResponse.json | 13 ++++++++ 4 files changed, 72 insertions(+) create mode 100644 app/swagger/paths/Login.json create mode 100644 app/swagger/schemas/LoginRequest.json create mode 100644 app/swagger/schemas/LoginResponse.json diff --git a/app/config.py b/app/config.py index b23548a..b0d43e4 100644 --- a/app/config.py +++ b/app/config.py @@ -30,6 +30,9 @@ class Config: JWT_REFRESH_TOKEN_EXPIRES = os.getenv( "JWT_REFRESH_TOKEN_EXPIRES", timedelta(days=30) ) + JWT_TOKEN_LOCATION = ["headers"] + JWT_HEADER_NAME = "Authorization" + JWT_HEADER_TYPE = "Bearer" KAFKA_BROKER = 'dev-events.simbrellang.net:9085' KAFKA_PAYMENT_TOPIC = 'PROCESS_PAYMENT' diff --git a/app/swagger/paths/Login.json b/app/swagger/paths/Login.json new file mode 100644 index 0000000..290a6b7 --- /dev/null +++ b/app/swagger/paths/Login.json @@ -0,0 +1,42 @@ +{ + "post": { + "tags": [ + "Authentication" + ], + "summary": "User login", + "description": "Authenticate a user and return a JWT token", + "operationId": "login", + "requestBody": { + "description": "User credentials", + "content": { + "application/json": { + "schema": { + "$ref": "../schemas/LoginRequest.json" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Successful operation", + "content": { + "application/json": { + "schema": { + "$ref": "../schemas/LoginResponse.json" + } + } + } + }, + "400": { + "description": "Invalid request" + }, + "401": { + "description": "Invalid username or password" + }, + "500": { + "description": "Internal server error" + } + } + } +} \ No newline at end of file diff --git a/app/swagger/schemas/LoginRequest.json b/app/swagger/schemas/LoginRequest.json new file mode 100644 index 0000000..8200994 --- /dev/null +++ b/app/swagger/schemas/LoginRequest.json @@ -0,0 +1,14 @@ +{ + "type": "object", + "properties": { + "username": { + "type": "string", + "example": "digifiuser" + }, + "password": { + "type": "string", + "example": "digifipass" + } + }, + "required": ["username", "password"] +} \ No newline at end of file diff --git a/app/swagger/schemas/LoginResponse.json b/app/swagger/schemas/LoginResponse.json new file mode 100644 index 0000000..a5e2b38 --- /dev/null +++ b/app/swagger/schemas/LoginResponse.json @@ -0,0 +1,13 @@ +{ + "type": "object", + "properties": { + "jwt_token": { + "type": "string", + "example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJkaWdpZml1c2VyIiwibmFtZSI6ImJhY2tvZmZpY2UgdXNlciIsImlhdCI6MTUxNjIzOTAyMn0.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c" + }, + "name": { + "type": "string", + "example": "backoffice user" + } + } +} \ No newline at end of file -- 2.34.1