@@ -129,12 +129,23 @@ def prepare_for_negotiated_authenticate(
129
129
"""
130
130
131
131
expected_binding = binding
132
+ bindings_to_try = (
133
+ [BINDING_HTTP_REDIRECT , BINDING_HTTP_POST ]
134
+ if not expected_binding
135
+ else [expected_binding ]
136
+ )
132
137
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 ))
136
147
137
- destination = self . sso_location ( entityid , binding )
148
+ for binding , destination in binding_destinations :
138
149
logger .info ("destination to provider: %s" , destination )
139
150
140
151
# XXX - sign_post will embed the signature to the xml doc
@@ -172,7 +183,12 @@ def prepare_for_negotiated_authenticate(
172
183
173
184
return reqid , binding , http_info
174
185
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 )
176
192
177
193
def global_logout (
178
194
self ,
0 commit comments