@@ -313,30 +313,25 @@ def create_authn_request(self, destination, vorg="", scoping=None,
313
313
314
314
args = {}
315
315
316
- if self .config .getattr ('hide_assertion_consumer_service' , 'sp' ):
316
+ # AssertionConsumerServiceURL
317
+ # AssertionConsumerServiceIndex
318
+ hide_assertion_consumer_service = self .config .getattr ('hide_assertion_consumer_service' , 'sp' )
319
+ assertion_consumer_service_url = (
320
+ kwargs .pop ("assertion_consumer_service_urls" , [None ])[0 ]
321
+ or kwargs .pop ("assertion_consumer_service_url" , None )
322
+ )
323
+ assertion_consumer_service_index = kwargs .pop ("assertion_consumer_service_index" , None )
324
+ service_url = (self .service_urls (service_url_binding or binding ) or [None ])[0 ]
325
+ if hide_assertion_consumer_service :
317
326
args ["assertion_consumer_service_url" ] = None
318
327
binding = None
319
- else :
320
- try :
321
- args ["assertion_consumer_service_url" ] = kwargs [
322
- "assertion_consumer_service_urls" ][0 ]
323
- del kwargs ["assertion_consumer_service_urls" ]
324
- except KeyError :
325
- try :
326
- args ["assertion_consumer_service_url" ] = kwargs [
327
- "assertion_consumer_service_url" ]
328
- del kwargs ["assertion_consumer_service_url" ]
329
- except KeyError :
330
- try :
331
- args ["assertion_consumer_service_index" ] = str (
332
- kwargs ["assertion_consumer_service_index" ])
333
- del kwargs ["assertion_consumer_service_index" ]
334
- except KeyError :
335
- if service_url_binding is None :
336
- service_urls = self .service_urls (binding )
337
- else :
338
- service_urls = self .service_urls (service_url_binding )
339
- args ["assertion_consumer_service_url" ] = service_urls [0 ]
328
+ elif assertion_consumer_service_url :
329
+ args ["assertion_consumer_service_url" ] = assertion_consumer_service_url
330
+ elif assertion_consumer_service_index :
331
+ args ["assertion_consumer_service_index" ] = assertion_consumer_service_index
332
+ elif service_url :
333
+ args ["assertion_consumer_service_url" ] = service_url
334
+
340
335
341
336
try :
342
337
args ["provider_name" ] = kwargs ["provider_name" ]
0 commit comments