@@ -136,6 +136,13 @@ def login(request,
136
136
selected_idp = request .GET .get ('idp' , None )
137
137
conf = get_config (config_loader_path , request )
138
138
139
+ kwargs = {}
140
+ # pysaml needs a string otherwise: "cannot serialize True (type bool)"
141
+ if getattr (conf , '_sp_force_authn' ):
142
+ kwargs ['force_authn' ] = "true"
143
+ if getattr (conf , '_sp_allow_create' , "false" ):
144
+ kwargs ['allow_create' ] = "true"
145
+
139
146
# is a embedded wayf needed?
140
147
idps = available_idps (conf )
141
148
if selected_idp is None and len (idps ) > 1 :
@@ -184,7 +191,7 @@ def login(request,
184
191
session_id , result = client .prepare_for_authenticate (
185
192
entityid = selected_idp , relay_state = came_from ,
186
193
binding = binding , sign = False , sigalg = sigalg ,
187
- nsprefix = nsprefix )
194
+ nsprefix = nsprefix , ** kwargs )
188
195
except TypeError as e :
189
196
logger .error ('Unable to know which IdP to use' )
190
197
return HttpResponse (text_type (e ))
@@ -200,7 +207,8 @@ def login(request,
200
207
return HttpResponse (text_type (e ))
201
208
session_id , request_xml = client .create_authn_request (
202
209
location ,
203
- binding = binding )
210
+ binding = binding ,
211
+ ** kwargs )
204
212
try :
205
213
if PY3 :
206
214
saml_request = base64 .b64encode (binary_type (request_xml , 'UTF-8' ))
0 commit comments