File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change
1
+ class IdPConfigurationMissing (Exception ):
2
+ pass
Original file line number Diff line number Diff line change 57
57
58
58
from djangosaml2 .cache import IdentityCache , OutstandingQueriesCache
59
59
from djangosaml2 .cache import StateCache
60
+ from djangosaml2 .exceptions import IdPConfigurationMissing
60
61
from djangosaml2 .conf import get_config
61
62
from djangosaml2 .overrides import Saml2Client
62
63
from djangosaml2 .signals import post_authenticated
@@ -159,7 +160,13 @@ def login(request,
159
160
'available_idps' : idps .items (),
160
161
'came_from' : came_from ,
161
162
})
162
-
163
+ else :
164
+ # is the first one, otherwise next logger message will print None
165
+ if not idps :
166
+ raise IdPConfigurationMissing (('IdP configuration is missing or '
167
+ 'its metadata is expired.' ))
168
+ selected_idp = list (idps .keys ())[0 ]
169
+
163
170
# choose a binding to try first
164
171
sign_requests = getattr (conf , '_sp_authn_requests_signed' , False )
165
172
binding = BINDING_HTTP_POST if sign_requests else BINDING_HTTP_REDIRECT
You can’t perform that action at this time.
0 commit comments