Skip to content
This repository has been archived by the owner on Jul 17, 2022. It is now read-only.

Commit

Permalink
fix: update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
coderbyheart committed Aug 25, 2021
1 parent e415c3f commit eb7c444
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions docs/authentication.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
# Authentication

The backend authenticates requests using signed cookies so they can contain user information so that it does not have to be fetched for every request.
The backend authenticates requests using signed cookies which contains user's id so that it does not have to be fetched for every request.

The cookie contains the user's id.
Cookies are sent [`secure` and `HttpOnly`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#restrict_access_to_cookies) when users register their account, or when they log in using username and password.

Cookies are sent [`secure` and `HttpOnly`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#restrict_access_to_cookies) when users register their account, or when they login using username and password.
Cookies expire after 30 minutes and the client is responsible for renewing cookies by calling the `GET /me/cookie` endpoint before they expire.

Cookies expire after 30 minutes and the client is responsible to renew cookies by calling the `GET /me/cookie` endpoint before they expire.

When renewing cookies the server will re-check if the user still exists and if they haven't changed their password. For this a hash of the user's password hash, email, username, and id will be generated and included in the cookie. If any of these properties changes, the cookie cannot be renewed and the user has to log-in again.
When renewing cookies, the server will re-check if the user still exists and if they haven't changed their password. For this a hash of the user's password hash, email, username, and id will be generated and included in the cookie. If any of these properties changes, the cookie cannot be renewed and the user has to log-in again.

## Admin permissions

Admin permission are granted via the `isAdmin` flag on the `UserAccount`.
Admin permission are granted via the `isAdmin` flag on the `UserAccount` model.

## Configuration

Expand Down

0 comments on commit eb7c444

Please sign in to comment.