Purpose
This WS is designed to terminate users authenticated session based on a valid access token.
Key points
Only authenticated user with a valid access token can perform logout process.
Logout process terminates current access token for user and client as well as refresh token.
Specification
Validations
Authorization
Verify the validity of the access token
in case of error - return 401 (“Invalid access token”)
Verify that token is not expired
in case of error - return 401 (“Invalid access token”)
Service logic
Expire access token from Authorization header based on token type:
if opaque - update values in mithril database,
tokens
table, set:expired_at = now()
updated_at = now()
if JWT - create key in redis cache with name blacklist_jti_<<token_id>>, where token_id =
jti
value from token, TTL = time between now() andexp
of token;
Get
refresh_token
value from access token, expire it, update values in mithril database,tokens
table, set:expired_at = now()
updated_at = now()