@@ -144,6 +144,13 @@ def login(request,
144
144
selected_idp = request .GET .get ('idp' , None )
145
145
conf = get_config (config_loader_path , request )
146
146
147
+ kwargs = {}
148
+ # pysaml needs a string otherwise: "cannot serialize True (type bool)"
149
+ if getattr (conf , '_sp_force_authn' ):
150
+ kwargs ['force_authn' ] = "true"
151
+ if getattr (conf , '_sp_allow_create' , "false" ):
152
+ kwargs ['allow_create' ] = "true"
153
+
147
154
# is a embedded wayf needed?
148
155
idps = available_idps (conf )
149
156
if selected_idp is None and len (idps ) > 1 :
@@ -192,7 +199,7 @@ def login(request,
192
199
session_id , result = client .prepare_for_authenticate (
193
200
entityid = selected_idp , relay_state = came_from ,
194
201
binding = binding , sign = False , sigalg = sigalg ,
195
- nsprefix = nsprefix )
202
+ nsprefix = nsprefix , ** kwargs )
196
203
except TypeError as e :
197
204
logger .error ('Unable to know which IdP to use' )
198
205
return HttpResponse (text_type (e ))
@@ -208,7 +215,8 @@ def login(request,
208
215
return HttpResponse (text_type (e ))
209
216
session_id , request_xml = client .create_authn_request (
210
217
location ,
211
- binding = binding )
218
+ binding = binding ,
219
+ ** kwargs )
212
220
try :
213
221
if PY3 :
214
222
saml_request = base64 .b64encode (binary_type (request_xml , 'UTF-8' )).decode ('utf-8' )
0 commit comments