feat(api): declare identity contract for registration, verification, and sessions
This commit is contained in:
1 parent
197661145e
commit
653f3775f8
86 files changed
+11826
-148
No files matched your search
@@ -0,0 +1,60 @@
|
||||
get:
|
||||
operationId: GetCurrentSession
|
||||
summary: Read the current session and its CSRF token.
|
||||
description: |-
|
||||
Requires the session cookie. Returns the account and the CSRF token of the current session, so the client can restore the token after a page reload or after 403 csrf_check_failed. A missing, unknown, expired, or revoked session answers 401 unauthenticated. Cross-origin pages cannot read the token, because the API sends no Access-Control-Allow-Origin header.
|
||||
security:
|
||||
- sessionCookie: []
|
||||
tags:
|
||||
- identity
|
||||
responses:
|
||||
"200":
|
||||
description: The current session.
|
||||
headers:
|
||||
Cache-Control:
|
||||
$ref: ../components/headers.yml#/CacheControlNoStore
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../components/schemas.yml#/Session
|
||||
examples:
|
||||
candidate:
|
||||
$ref: ../components/examples.yml#/CandidateSession
|
||||
"401":
|
||||
$ref: ../components/responses.yml#/Unauthenticated
|
||||
default:
|
||||
$ref: ../components/responses.yml#/Problem
|
||||
delete:
|
||||
operationId: Logout
|
||||
summary: Sign out and revoke the current session.
|
||||
description: |-
|
||||
Requires the session cookie and the CSRF token of that session in X-CSRF-Token, and an allowed Origin. The server revokes the session in PostgreSQL, so the cookie value stops working even if a copy remains, and clears the cookie. A missing, expired, or revoked session answers 401 unauthenticated and also clears the cookie, so a stale cookie does not stay in the browser; a missing or wrong CSRF token or a disallowed Origin answers 403 csrf_check_failed and keeps the session and the cookie. The client clears its private query cache after the response.
|
||||
security:
|
||||
- sessionCookie: []
|
||||
sessionCsrf: []
|
||||
tags:
|
||||
- identity
|
||||
responses:
|
||||
"204":
|
||||
description: The session is revoked and the cookie is cleared.
|
||||
headers:
|
||||
Set-Cookie:
|
||||
$ref: ../components/headers.yml#/SessionCookieCleared
|
||||
"401":
|
||||
description: >-
|
||||
No valid session; code unauthenticated. The cookie is cleared as
|
||||
well.
|
||||
headers:
|
||||
Set-Cookie:
|
||||
$ref: ../components/headers.yml#/SessionCookieCleared
|
||||
content:
|
||||
application/problem+json:
|
||||
schema:
|
||||
$ref: ../components/schemas.yml#/Problem
|
||||
examples:
|
||||
unauthenticated:
|
||||
$ref: ../components/examples.yml#/Unauthenticated
|
||||
"403":
|
||||
$ref: ../components/responses.yml#/CsrfCheckFailed
|
||||
default:
|
||||
$ref: ../components/responses.yml#/Problem
|
||||
Reference in new issue
Block a user