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 5757
5858from djangosaml2 .cache import IdentityCache , OutstandingQueriesCache
5959from djangosaml2 .cache import StateCache
60+ from djangosaml2 .exceptions import IdPConfigurationMissing
6061from djangosaml2 .conf import get_config
6162from djangosaml2 .overrides import Saml2Client
6263from djangosaml2 .signals import post_authenticated
@@ -159,7 +160,13 @@ def login(request,
159160 'available_idps' : idps .items (),
160161 'came_from' : came_from ,
161162 })
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+
163170 # choose a binding to try first
164171 sign_requests = getattr (conf , '_sp_authn_requests_signed' , False )
165172 binding = BINDING_HTTP_POST if sign_requests else BINDING_HTTP_REDIRECT
You can’t perform that action at this time.
0 commit comments