django-session-csrf

Software Screenshot:
django-session-csrf
Software Details:
Version: 0.5
Upload Date: 15 Apr 15
Developer: Jeff Balogh
Distribution Type: Freeware
Downloads: 12

Rating: 3.0/5 (Total Votes: 1)

django-session-csrf is an alternative implementation of Django's CSRF protection that does not use cookies. Instead, it maintains the CSRF token on the server using Django's session backend. The csrf token must still be included in all POST requests (either with csrfmiddlewaretoken in the form or with the X-CSRFTOKEN header).

Installation:


From PyPI:

pip install django-session-csrf

From github:

git clone git://github.com/mozilla/django-session-csrf.git

Replace django.core.context_processors.csrf with session_csrf.context_processor in your

TEMPLATE_CONTEXT_PROCESSORS:

TEMPLATE_CONTEXT_PROCESSORS = (
 ...
 'session_csrf.context_processor',
 ...
)


Replace django.middleware.csrf.CsrfViewMiddleware with session_csrf.CsrfMiddleware in your MIDDLEWARE_CLASSES:

MIDDLEWARE_CLASSES = (
 ...
 'session_csrf.CsrfMiddleware',
 ...
)


Then we have to monkeypatch Django to fix the @csrf_protect decorator:

import session_csrf
session_csrf.monkeypatch()


Make sure that's in something like manage.py so the patch gets applied before your views are imported.

Requirements:

  • Python

Other Software of Developer Jeff Balogh

django-pylibmc
django-pylibmc

20 Feb 15

django-nose
django-nose

14 Apr 15

Comments to django-session-csrf

Comments not found
Add Comment
Turn on images!