Skip to content

Commit 3fbc042

Browse files
committed
FEATURE: added USE_ROLLING_SESSIONS
1 parent 02535b4 commit 3fbc042

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

doc/source/configuration.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,11 @@ These settings configure the login form and session handling.
224224
``0``, no expiry. If :envvar:`USE_ROLLING_SESSIONS` is ``True``, this
225225
value is used to reset the session lifetime on every request.
226226

227+
.. envvar:: USE_ROLLING_SESSIONS
228+
229+
If ``True``, session lifetime will be reset to :envvar:`SESSION_MAX_AGE` on
230+
every request. Defaults to ``False``.
231+
227232
.. envvar:: SECRET_KEY
228233

229234
**Required** The secret key to use for the session. Defaults to ``SESSION_SECRET``.

etc/environment.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ LDAP_BASEDN=ou=users,dc=example,dc=com
77

88
# COOKIE_NAME=nginxauth
99
# SESSION_MAX_AGE=0
10+
# USE_ROLLING_SESSIONS=False
1011
# SESSION_BACKEND=memory
1112
# REDIS_URL=redis://localhost
1213
# REDIS_PREFIX=nginx_ldap_auth.

nginx_ldap_auth/settings.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ class Settings(BaseSettings):
4040
secret_key: str
4141
#: The maximum age of a session cookie in seconds
4242
session_max_age: int = 0
43+
#: Reset the session lifetime to :py:attr:`session_max_age` every time the
44+
#: user accesses the protected site
45+
use_rolling_session: bool = False
4346
#: Session type: either ``redis`` or ``memory``
4447
session_backend: Literal['redis', 'memory'] = 'memory'
4548
#: If using the Redis session backend, the DSN on which to connect to Redis.

0 commit comments

Comments
 (0)