File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,16 @@ def _get_subject_id(session):
68
68
return None
69
69
70
70
71
+ def callable_bool (value ):
72
+ """ A compatibility wrapper for pre Django 1.10 User model API that used
73
+ is_authenticated() and is_anonymous() methods instead of attributes
74
+ """
75
+ if callable (value ):
76
+ return value ()
77
+ else :
78
+ return value
79
+
80
+
71
81
def login (request ,
72
82
config_loader_path = None ,
73
83
wayf_template = 'djangosaml2/wayf.html' ,
@@ -109,7 +119,7 @@ def login(request,
109
119
# SAML_IGNORE_AUTHENTICATED_USERS_ON_LOGIN setting. If that setting
110
120
# is True (default value) we will redirect him to the came_from view.
111
121
# Otherwise, we will show an (configurable) authorization error.
112
- if request .user .is_authenticated :
122
+ if callable_bool ( request .user .is_authenticated ) :
113
123
redirect_authenticated_user = getattr (settings , 'SAML_IGNORE_AUTHENTICATED_USERS_ON_LOGIN' , True )
114
124
if redirect_authenticated_user :
115
125
return HttpResponseRedirect (came_from )
You can’t perform that action at this time.
0 commit comments