feat(identity): add bounded login and revocable sessions
This commit is contained in:
@@ -1,6 +1,39 @@
|
||||
{
|
||||
"components": {
|
||||
"schemas": {
|
||||
"CurrentUser": {
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"id": {
|
||||
"format": "uuid",
|
||||
"title": "Id",
|
||||
"type": "string"
|
||||
},
|
||||
"username": {
|
||||
"title": "Username",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"username"
|
||||
],
|
||||
"title": "CurrentUser",
|
||||
"type": "object"
|
||||
},
|
||||
"HTTPValidationError": {
|
||||
"properties": {
|
||||
"detail": {
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/ValidationError"
|
||||
},
|
||||
"title": "Detail",
|
||||
"type": "array"
|
||||
}
|
||||
},
|
||||
"title": "HTTPValidationError",
|
||||
"type": "object"
|
||||
},
|
||||
"HealthResponse": {
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
@@ -26,16 +59,183 @@
|
||||
],
|
||||
"title": "HealthResponse",
|
||||
"type": "object"
|
||||
},
|
||||
"LoginRequest": {
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"password": {
|
||||
"format": "password",
|
||||
"maxLength": 128,
|
||||
"minLength": 12,
|
||||
"title": "Password",
|
||||
"type": "string",
|
||||
"writeOnly": true
|
||||
},
|
||||
"username": {
|
||||
"pattern": "^[a-z0-9_]{3,24}$",
|
||||
"title": "Username",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"username",
|
||||
"password"
|
||||
],
|
||||
"title": "LoginRequest",
|
||||
"type": "object"
|
||||
},
|
||||
"LoginResponse": {
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"csrf_token": {
|
||||
"maxLength": 64,
|
||||
"minLength": 64,
|
||||
"pattern": "^[0-9a-f]{64}$",
|
||||
"title": "Csrf Token",
|
||||
"type": "string"
|
||||
},
|
||||
"expires_at": {
|
||||
"format": "date-time",
|
||||
"title": "Expires At",
|
||||
"type": "string"
|
||||
},
|
||||
"user": {
|
||||
"$ref": "#/components/schemas/CurrentUser"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"user",
|
||||
"expires_at",
|
||||
"csrf_token"
|
||||
],
|
||||
"title": "LoginResponse",
|
||||
"type": "object"
|
||||
},
|
||||
"ValidationError": {
|
||||
"properties": {
|
||||
"ctx": {
|
||||
"title": "Context",
|
||||
"type": "object"
|
||||
},
|
||||
"input": {
|
||||
"title": "Input"
|
||||
},
|
||||
"loc": {
|
||||
"items": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "integer"
|
||||
}
|
||||
]
|
||||
},
|
||||
"title": "Location",
|
||||
"type": "array"
|
||||
},
|
||||
"msg": {
|
||||
"title": "Message",
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"title": "Error Type",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"loc",
|
||||
"msg",
|
||||
"type"
|
||||
],
|
||||
"title": "ValidationError",
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"info": {
|
||||
"description": "工程骨架。当前只提供进程存活检查,业务接口逐项实现。",
|
||||
"description": "平台 API。身份使用真实可撤销会话,业务接口按模块逐项接入。",
|
||||
"title": "KF-OnlineJudge Platform API",
|
||||
"version": "0.0.1"
|
||||
},
|
||||
"openapi": "3.1.0",
|
||||
"paths": {
|
||||
"/api/v1/auth/login": {
|
||||
"post": {
|
||||
"operationId": "login_api_v1_auth_login_post",
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/LoginRequest"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": true
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/LoginResponse"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
},
|
||||
"422": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/HTTPValidationError"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Validation Error"
|
||||
}
|
||||
},
|
||||
"summary": "Login",
|
||||
"tags": [
|
||||
"identity"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v1/auth/logout": {
|
||||
"post": {
|
||||
"operationId": "logout_api_v1_auth_logout_post",
|
||||
"responses": {
|
||||
"204": {
|
||||
"description": "Successful Response"
|
||||
}
|
||||
},
|
||||
"summary": "Logout",
|
||||
"tags": [
|
||||
"identity"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v1/auth/me": {
|
||||
"get": {
|
||||
"operationId": "me_api_v1_auth_me_get",
|
||||
"responses": {
|
||||
"200": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/CurrentUser"
|
||||
}
|
||||
}
|
||||
},
|
||||
"description": "Successful Response"
|
||||
}
|
||||
},
|
||||
"summary": "Me",
|
||||
"tags": [
|
||||
"identity"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/v1/health/live": {
|
||||
"get": {
|
||||
"description": "Check process liveness only; does not attest DB, queue or judge readiness.",
|
||||
|
||||
Reference in New Issue
Block a user