Introduced a secure login flow using JWTs with dynamically generated RSA key pairs stored in the database. Updated relevant APIs, database schema, and services to support login codes, JWT encoding, and secret validation.
92 lines
2.3 KiB
YAML
92 lines
2.3 KiB
YAML
UserLogin:
|
|
get:
|
|
tags:
|
|
- login
|
|
summary: Log in to the site
|
|
description: Log in to the site through a code from the server
|
|
operationId: login
|
|
parameters:
|
|
- $ref: '#/components/parameters/Code'
|
|
responses:
|
|
'200':
|
|
description: Logged in
|
|
content:
|
|
application/text:
|
|
schema:
|
|
type: string
|
|
description: A JWT token for this user
|
|
'401':
|
|
description: Login failed - Invalid credentials
|
|
content:
|
|
application/text:
|
|
schema:
|
|
$ref: '../generic/errors.yml#/components/schemas/ApiError'
|
|
default:
|
|
description: Unexpected error
|
|
content:
|
|
application/text:
|
|
schema:
|
|
$ref: '../generic/errors.yml#/components/schemas/ApiError'
|
|
RequestNewUserLogin:
|
|
get:
|
|
tags:
|
|
- login
|
|
summary: Request a login
|
|
description: Request a code, that can be used to log in
|
|
operationId: requestLogin
|
|
parameters:
|
|
- name: Authorization
|
|
in: header
|
|
required: true
|
|
schema:
|
|
type: string
|
|
description: Secret
|
|
- $ref: '../generic/parameters.yml#/components/parameters/Uuid'
|
|
responses:
|
|
'200':
|
|
description: Success
|
|
content:
|
|
application/text:
|
|
schema:
|
|
type: string
|
|
description: code to log in with
|
|
'401':
|
|
description: Login failed - Invalid secret
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '../generic/errors.yml#/components/schemas/ApiError'
|
|
default:
|
|
description: Unexpected error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '../generic/errors.yml#/components/schemas/ApiError'
|
|
components:
|
|
parameters:
|
|
Code:
|
|
name: code
|
|
in: path
|
|
required: true
|
|
schema:
|
|
type: string
|
|
description: The code to log in with
|
|
schemas:
|
|
LoginData:
|
|
type: object
|
|
required:
|
|
- loginCode
|
|
properties:
|
|
loginCode:
|
|
type: string
|
|
description: The code to log in
|
|
AddLogin:
|
|
type: object
|
|
required:
|
|
- uuid
|
|
properties:
|
|
uuid:
|
|
type: string
|
|
format: uuid
|
|
description: UUID of the user that will get logged in
|