Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

root: allow configuring session cookie age #12389

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions authentik/lib/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ remote_debug: false
log_level: info

session_storage: cache
sessions:
cookie_age: days=14

error_reporting:
enabled: false
Expand Down
2 changes: 2 additions & 0 deletions authentik/root/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from authentik.lib.logging import get_logger_config, structlog_configure
from authentik.lib.sentry import sentry_init
from authentik.lib.utils.reflection import get_env
from authentik.lib.utils.time import timedelta_from_string
from authentik.stages.password import BACKEND_APP_PASSWORD, BACKEND_INBUILT, BACKEND_LDAP

BASE_DIR = Path(__file__).absolute().parent.parent.parent
Expand Down Expand Up @@ -239,6 +240,7 @@
# Configured via custom SessionMiddleware
# SESSION_COOKIE_SAMESITE = "None"
# SESSION_COOKIE_SECURE = True
SESSION_COOKIE_AGE = timedelta_from_string(CONFIG.get("sessions.cookie_age", "days=14"))
SESSION_EXPIRE_AT_BROWSER_CLOSE = True

MESSAGE_STORAGE = "authentik.root.messages.storage.ChannelsStorage"
Expand Down
6 changes: 6 additions & 0 deletions website/docs/install-config/configuration/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,12 @@ Defaults to `86400`.

Configure if the sessions are stored in the cache or the database. Defaults to `cache`. Allowed values are `cache` and `db`. Note that changing this value will invalidate all previous sessions.

### `AUTHENTIK_SESSIONS__COOKIE_AGE` <span class="badge badge--version">authentik 2024.12+</span>

Configure how long the session cookie is valid. Does not impact how long sessions are valid for. See [../../add-secure-apps/flows-stages/stages/user_login/index.md](the User login stage) for session validity.

Defaults to `days=14`.

### `AUTHENTIK_WEB__WORKERS` <span class="badge badge--version">authentik 2022.9+</span>

Configure how many gunicorn worker processes should be started (see https://docs.gunicorn.org/en/stable/design.html).
Expand Down
Loading