File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -38,16 +38,18 @@ def available_idps(config, langpref=None):
38
38
return dict ([(idp , config .metadata .name (idp , langpref )) for idp in idps ])
39
39
40
40
41
- def get_idp_sso_supported_bindings (idp_entity_id = None ):
41
+ def get_idp_sso_supported_bindings (idp_entity_id = None , config = None ):
42
42
"""Returns the list of bindings supported by an IDP
43
43
This is not clear in the pysaml2 code, so wrapping it in a util"""
44
- # avoid circular import
45
- from djangosaml2 .conf import get_config
44
+ if config is None :
45
+ # avoid circular import
46
+ from djangosaml2 .conf import get_config
47
+ config = get_config ()
46
48
# load metadata store from config
47
- config = get_config ()
48
49
meta = getattr (config , 'metadata' , {})
49
50
# if idp is None, assume only one exists so just use that
50
- idp_entity_id = available_idps (config ).keys ().pop ()
51
+ if idp_entity_id is None :
52
+ idp_entity_id = available_idps (config ).keys ().pop ()
51
53
try :
52
54
return meta .service (idp_entity_id , 'idpsso_descriptor' , 'single_sign_on_service' ).keys ()
53
55
except UnknownSystemEntity :
Original file line number Diff line number Diff line change @@ -161,7 +161,7 @@ def login(request,
161
161
binding = BINDING_HTTP_POST if sign_requests else BINDING_HTTP_REDIRECT
162
162
163
163
# ensure our selected binding is supported by the IDP
164
- supported_bindings = get_idp_sso_supported_bindings (selected_idp )
164
+ supported_bindings = get_idp_sso_supported_bindings (selected_idp , config = conf )
165
165
if binding not in supported_bindings :
166
166
logger .debug ('Binding %s not in IDP %s supported bindings: %s' ,
167
167
binding , selected_idp , supported_bindings )
You can’t perform that action at this time.
0 commit comments