This release is a pre-release and may not be stable for production use.
A Django application which provides authentication-based session expiration.
To install this application into your project, first add it to your INSTALLED_APPS setting (and run manage.py syncdb):
INSTALLED_APPS = (
...
'django_expire',
)
Next, add the expiration middleware to your MIDDLEWARE_CLASSES setting, placing it after both the session and auth middleware.:
MIDDLEWARE_CLASSES = (
...
'django_expire.middleware.ExpireMiddleware',
)
What it does
For every request by an authenticated user, a check is run to ensure the number of other sessions also belonging to the user does not exceed the allowed maximum.
This maximum defaults to 1, but you can provide a EXPIRE_MAX_USERS setting to override this default (a setting of 0 allows an unlimited amount of users per session).
If a user has exceeded the number of sessions they are allowed, the excessive sessions are removed (effectively logging the user out of these now invalidated sessions).
Changing expiration settings per user
The django_expire.signals.expire_check allows you to change the expiration settings at a per-user level.
The signal is sent before any tests are run, along with a settings dictionary containing a single max_users key. Signal handlers may change the value of the dictionary to alter the settings for this user.
An example handler (which is not automatically connected) can be found in django_expire.signals.superuser_handler which demonstrates allowing superusers an unlimited number of sessions.
Metadata
Release files for django-expire 1.0-alpha-2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django-expire-1.0-alpha-2.tar.gz | 3.7 kB | Details |
Release files / django-expire-1.0-alpha-2.tar.gz
| Download URL | django-expire-1.0-alpha-2.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eddebd662e6d42cdfd10b290e70c58297ae46f40369958f2b865b592077b44c7
|
|
BLAKE2b-256 checksum How to use checksums |
c3de33ff0314891470d0f82c4c53d1d807995e84708eb2130fdd1db7a7b836f6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |