FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects
Commit 2aedd422 authored by Dr Abraham Martin's avatar Dr Abraham Martin
Browse files

RemoteUserBackend has different signature for authenticate on django >1.8

parent 81716d6e
No related branches found
No related tags found
No related merge requests found
import django
import logging
from django.contrib.auth.backends import RemoteUserBackend
from ucamwebauth import RavenResponse
......@@ -13,7 +14,7 @@ class RavenAuthBackend(RemoteUserBackend):
'ucamwebauth.backends.RavenAuthBackend' to AUTHENTICATION_BACKENDS
in your django settings.py."""
def authenticate(self, response_req=None):
def authenticate(self, response_req=None, **kwargs):
"""Checks a response from the Raven server and sees if it is valid. If
it is, returns the User with the same username as the Raven username.
@return User object, or None if authentication failed"""
......@@ -35,7 +36,10 @@ class RavenAuthBackend(RemoteUserBackend):
"access this site"))
raise UserNotAuthorised("Authentication successful but you are not authorised to access this site")
return super(RavenAuthBackend, self).authenticate(response.principal)
if django.VERSION[0] <= 1 and django.VERSION[1] <= 8:
return super(RavenAuthBackend, self).authenticate(response.principal)
else:
return super(RavenAuthBackend, self).authenticate(response_req, response.principal)
# Backwards compatibility: honour UCAMWEBAUTH_CREATE_USER.
@property
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment