160 lines
7.0 KiB
YAML
160 lines
7.0 KiB
YAML
openapi: 3.2.0
|
|
info:
|
|
title: Lincodex API
|
|
version: 0.1.0
|
|
servers:
|
|
- url: /
|
|
tags:
|
|
- name: health
|
|
description: Liveness of the API process.
|
|
- name: identity
|
|
description: >-
|
|
Registration, email verification, login, logout, and the current
|
|
account. Sessions are server-side and travel in an HttpOnly cookie;
|
|
mutating requests that require a session also carry a CSRF token.
|
|
# Operations require a session unless they declare `security: []`, so a new
|
|
# operation that omits security is protected by default.
|
|
security:
|
|
- sessionCookie: []
|
|
paths:
|
|
/api/v1/healthz:
|
|
$ref: ./routes/healthz.yml
|
|
/api/v1/identity/consent-texts/{purpose}:
|
|
$ref: ./routes/identity_consent_texts.yml
|
|
/api/v1/identity/registrations:
|
|
$ref: ./routes/identity_registrations.yml
|
|
/api/v1/identity/email-verification-requests:
|
|
$ref: ./routes/identity_email_verification_requests.yml
|
|
/api/v1/identity/email-verifications:
|
|
$ref: ./routes/identity_email_verifications.yml
|
|
/api/v1/identity/sessions:
|
|
$ref: ./routes/identity_sessions.yml
|
|
/api/v1/identity/sessions/current:
|
|
$ref: ./routes/identity_sessions_current.yml
|
|
/api/v1/identity/me:
|
|
$ref: ./routes/identity_me.yml
|
|
components:
|
|
schemas:
|
|
Problem:
|
|
$ref: ./components/schemas.yml#/Problem
|
|
ProblemCode:
|
|
$ref: ./components/schemas.yml#/ProblemCode
|
|
ProblemFieldError:
|
|
$ref: ./components/schemas.yml#/ProblemFieldError
|
|
ProblemFieldLocation:
|
|
$ref: ./components/schemas.yml#/ProblemFieldLocation
|
|
Timestamp:
|
|
$ref: ./components/schemas.yml#/Timestamp
|
|
PageInfo:
|
|
$ref: ./components/schemas.yml#/PageInfo
|
|
EmailAddress:
|
|
$ref: ./components/schemas.yml#/EmailAddress
|
|
NewPassword:
|
|
$ref: ./components/schemas.yml#/NewPassword
|
|
LoginPassword:
|
|
$ref: ./components/schemas.yml#/LoginPassword
|
|
AccountScenario:
|
|
$ref: ./components/schemas.yml#/AccountScenario
|
|
OnboardingStep:
|
|
$ref: ./components/schemas.yml#/OnboardingStep
|
|
ConsentPurpose:
|
|
$ref: ./components/schemas.yml#/ConsentPurpose
|
|
ConsentText:
|
|
$ref: ./components/schemas.yml#/ConsentText
|
|
ConsentTextVersion:
|
|
$ref: ./components/schemas.yml#/ConsentTextVersion
|
|
PersonalDataConsentAcceptance:
|
|
$ref: ./components/schemas.yml#/PersonalDataConsentAcceptance
|
|
RegistrationRequest:
|
|
$ref: ./components/schemas.yml#/RegistrationRequest
|
|
EmailVerificationResendRequest:
|
|
$ref: ./components/schemas.yml#/EmailVerificationResendRequest
|
|
IdentityRequestAccepted:
|
|
$ref: ./components/schemas.yml#/IdentityRequestAccepted
|
|
VerificationToken:
|
|
$ref: ./components/schemas.yml#/VerificationToken
|
|
EmailVerificationRequest:
|
|
$ref: ./components/schemas.yml#/EmailVerificationRequest
|
|
EmailVerificationResult:
|
|
$ref: ./components/schemas.yml#/EmailVerificationResult
|
|
LoginRequest:
|
|
$ref: ./components/schemas.yml#/LoginRequest
|
|
CsrfToken:
|
|
$ref: ./components/schemas.yml#/CsrfToken
|
|
Account:
|
|
$ref: ./components/schemas.yml#/Account
|
|
Session:
|
|
$ref: ./components/schemas.yml#/Session
|
|
parameters:
|
|
IdempotencyKey:
|
|
$ref: ./components/parameters.yml#/IdempotencyKey
|
|
IfMatch:
|
|
$ref: ./components/parameters.yml#/IfMatch
|
|
PageLimit:
|
|
$ref: ./components/parameters.yml#/PageLimit
|
|
PageCursor:
|
|
$ref: ./components/parameters.yml#/PageCursor
|
|
headers:
|
|
ETag:
|
|
$ref: ./components/headers.yml#/ETag
|
|
RetryAfter:
|
|
$ref: ./components/headers.yml#/RetryAfter
|
|
SessionCookieSet:
|
|
$ref: ./components/headers.yml#/SessionCookieSet
|
|
SessionCookieCleared:
|
|
$ref: ./components/headers.yml#/SessionCookieCleared
|
|
CacheControlNoStore:
|
|
$ref: ./components/headers.yml#/CacheControlNoStore
|
|
responses:
|
|
ValidationFailed:
|
|
$ref: ./components/responses.yml#/ValidationFailed
|
|
Unauthenticated:
|
|
$ref: ./components/responses.yml#/Unauthenticated
|
|
Forbidden:
|
|
$ref: ./components/responses.yml#/Forbidden
|
|
NotFound:
|
|
$ref: ./components/responses.yml#/NotFound
|
|
IdempotencyInProgress:
|
|
$ref: ./components/responses.yml#/IdempotencyInProgress
|
|
StateConflict:
|
|
$ref: ./components/responses.yml#/StateConflict
|
|
PreconditionFailed:
|
|
$ref: ./components/responses.yml#/PreconditionFailed
|
|
PayloadTooLarge:
|
|
$ref: ./components/responses.yml#/PayloadTooLarge
|
|
UnprocessableContent:
|
|
$ref: ./components/responses.yml#/UnprocessableContent
|
|
PreconditionRequired:
|
|
$ref: ./components/responses.yml#/PreconditionRequired
|
|
TooManyRequests:
|
|
$ref: ./components/responses.yml#/TooManyRequests
|
|
Internal:
|
|
$ref: ./components/responses.yml#/Internal
|
|
NotImplemented:
|
|
$ref: ./components/responses.yml#/NotImplemented
|
|
Problem:
|
|
$ref: ./components/responses.yml#/Problem
|
|
RegistrationValidationFailed:
|
|
$ref: ./components/responses.yml#/RegistrationValidationFailed
|
|
EmailVerificationFailed:
|
|
$ref: ./components/responses.yml#/EmailVerificationFailed
|
|
InvalidCredentials:
|
|
$ref: ./components/responses.yml#/InvalidCredentials
|
|
CsrfCheckFailed:
|
|
$ref: ./components/responses.yml#/CsrfCheckFailed
|
|
securitySchemes:
|
|
sessionCookie:
|
|
type: apiKey
|
|
in: cookie
|
|
name: __Host-lincodex_session
|
|
description: |-
|
|
Opaque random session identifier issued by Login in an HttpOnly cookie with `Path=/; Secure; HttpOnly; SameSite=Strict` and no Domain. The server keeps the session in PostgreSQL, checks its expiry and revocation on every request, and derives the caller from it; operations never take a user identifier from the body. A session ends after an idle timeout of 24 hours or an absolute lifetime of 7 days, whichever comes first (planned values from configuration); activity extends only the idle deadline. A missing, unknown, expired, or revoked session answers 401 unauthenticated. Scripts cannot read the cookie, and it never appears in a body, log, or problem.
|
|
|
|
SameSite=Strict costs the single-page application nothing: its HTML is public and every API call is a same-origin fetch, which carries the cookie even right after a cross-site navigation, while cross-site requests never carry it.
|
|
sessionCsrf:
|
|
type: apiKey
|
|
in: header
|
|
name: X-CSRF-Token
|
|
description: |-
|
|
Synchronizer token bound to the session, returned by Login and GetCurrentSession. Every mutating operation that requires a session also requires this header; a missing token or one that does not belong to the session answers 403 csrf_check_failed. The token is defense in depth next to SameSite=Strict and the Origin check: every unsafe request (POST, PUT, PATCH, DELETE), including public ones such as Login, must carry an Origin from the configured allowlist, otherwise it answers 403 csrf_check_failed; a missing Origin is rejected too, and the server never derives the allowed Origin from the Host header. Request bodies are accepted only as application/json, which a cross-site form cannot send. A backend test requires every unsafe operation that requires sessionCookie to require this scheme as well.
|