feat: get impersonation token implementation
This commit is contained in:
parent
066c44d08a
commit
e67f0d7e5a
7 changed files with 209 additions and 95 deletions
|
|
@ -10,6 +10,7 @@ paths:
|
|||
/sign-up:
|
||||
post:
|
||||
summary: Sign up a new user
|
||||
operationId: postSignUp
|
||||
tags: [Auth]
|
||||
requestBody:
|
||||
required: true
|
||||
|
|
@ -41,6 +42,7 @@ paths:
|
|||
/sign-in:
|
||||
post:
|
||||
summary: Sign in a user and return JWT
|
||||
operationId: postSignIn
|
||||
tags: [Auth]
|
||||
requestBody:
|
||||
required: true
|
||||
|
|
@ -73,88 +75,52 @@ paths:
|
|||
user_name:
|
||||
type: string
|
||||
"401":
|
||||
description: Access denied due to invalid credentials
|
||||
$ref: '#/components/responses/UnauthorizedError'
|
||||
|
||||
/get-impersonation-token:
|
||||
post:
|
||||
summary: Get service impersontaion token
|
||||
operationId: getImpersonationToken
|
||||
tags: [Auth]
|
||||
security:
|
||||
- bearerAuth: []
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
user_id:
|
||||
type: integer
|
||||
format: int64
|
||||
tg_id:
|
||||
type: integer
|
||||
format: int64
|
||||
oneOf:
|
||||
- required: ["user_id"]
|
||||
- required: ["tg_id"]
|
||||
responses:
|
||||
"200":
|
||||
description: Generated impersonation access token
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
required:
|
||||
- access_token
|
||||
properties:
|
||||
error:
|
||||
access_token:
|
||||
type: string
|
||||
example: "Access denied"
|
||||
# /auth/verify-token:
|
||||
# post:
|
||||
# summary: Verify JWT validity
|
||||
# tags: [Auth]
|
||||
# requestBody:
|
||||
# required: true
|
||||
# content:
|
||||
# application/json:
|
||||
# schema:
|
||||
# type: object
|
||||
# required: [token]
|
||||
# properties:
|
||||
# token:
|
||||
# type: string
|
||||
# description: JWT token to validate
|
||||
# responses:
|
||||
# "200":
|
||||
# description: Token validation result
|
||||
# content:
|
||||
# application/json:
|
||||
# schema:
|
||||
# type: object
|
||||
# properties:
|
||||
# valid:
|
||||
# type: boolean
|
||||
# description: True if token is valid
|
||||
# user_id:
|
||||
# type: string
|
||||
# nullable: true
|
||||
# description: User ID extracted from token if valid
|
||||
# error:
|
||||
# type: string
|
||||
# nullable: true
|
||||
# description: Error message if token is invalid
|
||||
# /auth/refresh-token:
|
||||
# post:
|
||||
# summary: Refresh JWT using a refresh token
|
||||
# tags: [Auth]
|
||||
# requestBody:
|
||||
# required: true
|
||||
# content:
|
||||
# application/json:
|
||||
# schema:
|
||||
# type: object
|
||||
# required: [refresh_token]
|
||||
# properties:
|
||||
# refresh_token:
|
||||
# type: string
|
||||
# description: JWT refresh token obtained from sign-in
|
||||
# responses:
|
||||
# "200":
|
||||
# description: New access (and optionally refresh) token
|
||||
# content:
|
||||
# application/json:
|
||||
# schema:
|
||||
# type: object
|
||||
# properties:
|
||||
# valid:
|
||||
# type: boolean
|
||||
# description: True if refresh token was valid
|
||||
# user_id:
|
||||
# type: string
|
||||
# nullable: true
|
||||
# description: User ID extracted from refresh token
|
||||
# access_token:
|
||||
# type: string
|
||||
# description: New access token
|
||||
# nullable: true
|
||||
# refresh_token:
|
||||
# type: string
|
||||
# description: New refresh token (optional)
|
||||
# nullable: true
|
||||
# error:
|
||||
# type: string
|
||||
# nullable: true
|
||||
# description: Error message if refresh token is invalid
|
||||
description: JWT access token
|
||||
"401":
|
||||
$ref: '#/components/responses/UnauthorizedError'
|
||||
|
||||
components:
|
||||
securitySchemes:
|
||||
bearerAuth:
|
||||
type: http
|
||||
scheme: bearer
|
||||
responses:
|
||||
UnauthorizedError:
|
||||
description: Access token is missing or invalid
|
||||
Loading…
Add table
Add a link
Reference in a new issue