forked from webrunners/django-restricted-sessions
-
Notifications
You must be signed in to change notification settings - Fork 0
Restrict Django sessions to IP and/or user agent.
License
PicturePipe/django-restricted-sessions
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
============================= django-restricted-sessions ============================= .. image:: https://badge.fury.io/py/django-restricted-sessions.png :target: http://badge.fury.io/py/django-restricted-sessions .. image:: https://travis-ci.org/erikr/django-restricted-sessions.png?branch=master :target: https://travis-ci.org/erikr/django-restricted-sessions .. image:: https://coveralls.io/repos/erikr/django-restricted-sessions/badge.png?branch=master& :target: https://coveralls.io/r/erikr/django-restricted-sessions?branch=master Restricts Django sessions to IP and/or user agent. If the IP or user agent changes after creating the session, the a 400 response is given to the request, the session is flushed (all session data deleted, new session created) and a warning is logged. The goal of this middleware is to make it harder for an attacker to use a session ID they obtained. It does not make abuse of session IDs impossible. For compatibility with IPv6 privacy extensions, by default only the first 64 bits of an IPv6 address are checked. Documentation ------------- The full documentation is at https://django-restricted-sessions.readthedocs.org. Quickstart ---------- Install django-restricted-sessions:: pip install django-restricted-sessions Then add it to your middleware after SessionMiddleware:: MIDDLEWARE_CLASSES = [ .... 'django.contrib.sessions.middleware.SessionMiddleware', 'restrictedsessions.middleware.RestrictedSessionsMiddleware', .... ] If you enabled RESTRICTEDSESSIONS_AUTHED_ONLY -- add if after AuthenticationMiddleware (so request.user is present): MIDDLEWARE_CLASSES = [ .... 'django.contrib.auth.middleware.AuthenticationMiddleware', 'restrictedsessions.middleware.RestrictedSessionsMiddleware', .... ]
About
Restrict Django sessions to IP and/or user agent.
Resources
License
Contributing
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- Python 90.8%
- Makefile 9.2%