From 43d990c04d78b339449cbdfb092231f493ffa25d Mon Sep 17 00:00:00 2001 From: Nicolas Iooss Date: Thu, 14 Dec 2017 18:28:55 +0100 Subject: [PATCH] Use request.user.is_authenticated as a bool with recent Django (#216) Django 1.10 changed request.user.is_authenticated from a function to a boolean and Django 2.0 dropped the backward compatibility. In order to use django-oidc-provider with Django 2.0, AuthorizeView needs to handle request.user.is_authenticated as a boolean. --- oidc_provider/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oidc_provider/views.py b/oidc_provider/views.py index 72d941e..6b66f9b 100644 --- a/oidc_provider/views.py +++ b/oidc_provider/views.py @@ -65,7 +65,7 @@ class AuthorizeView(View): try: authorize.validate_params() - if request.user.is_authenticated(): + if (request.user.is_authenticated if django.VERSION >= (1, 10) else request.user.is_authenticated()): # Check if there's a hook setted. hook_resp = settings.get('OIDC_AFTER_USERLOGIN_HOOK', import_str=True)( request=request, user=request.user,