@@ -129,12 +129,23 @@ def prepare_for_negotiated_authenticate(
129129 """
130130
131131 expected_binding = binding
132+ bindings_to_try = (
133+ [BINDING_HTTP_REDIRECT , BINDING_HTTP_POST ]
134+ if not expected_binding
135+ else [expected_binding ]
136+ )
132137
133- for binding in [BINDING_HTTP_REDIRECT , BINDING_HTTP_POST ]:
134- if expected_binding and binding != expected_binding :
135- continue
138+ binding_destinations = []
139+ unsupported_bindings = []
140+ for binding in bindings_to_try :
141+ try :
142+ destination = self ._sso_location (entityid , binding )
143+ except Exception as e :
144+ unsupported_bindings .append (binding )
145+ else :
146+ binding_destinations .append ((binding , destination ))
136147
137- destination = self . sso_location ( entityid , binding )
148+ for binding , destination in binding_destinations :
138149 logger .info ("destination to provider: %s" , destination )
139150
140151 # XXX - sign_post will embed the signature to the xml doc
@@ -172,7 +183,12 @@ def prepare_for_negotiated_authenticate(
172183
173184 return reqid , binding , http_info
174185 else :
175- raise SignOnError ("No supported bindings available for authentication" )
186+ error_context = {
187+ "message" : "No supported bindings available for authentication" ,
188+ "bindings_to_try" : bindings_to_try ,
189+ "unsupported_bindings" : unsupported_bindings ,
190+ }
191+ raise SignOnError (error_context )
176192
177193 def global_logout (
178194 self ,
0 commit comments