61 lines
2.5 KiB
YAML
61 lines
2.5 KiB
YAML
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
|