Skip to content

Commit 56ddcfa

Browse files
authored
Merge pull request #157 from peppelinux/metadata_eid_exception
Metadata EntityID Exception
2 parents f45bd7b + 55f631f commit 56ddcfa

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

djangosaml2/views.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@
3838
StatusNoAuthnContext, StatusRequestDenied,
3939
UnsolicitedResponse)
4040
from saml2.s_utils import UnsupportedBinding
41+
from saml2.response import (
42+
StatusError, StatusAuthnFailed, SignatureError, StatusRequestDenied,
43+
UnsolicitedResponse, StatusNoAuthnContext,
44+
)
45+
from saml2.mdstore import SourceNotFound
4146
from saml2.sigver import MissingKey
4247
from saml2.validate import ResponseLifetimeExceed, ToEarly
4348
from saml2.xmldsig import ( # support for SHA1 is required by spec
@@ -124,7 +129,15 @@ def login(request,
124129
})
125130

126131
selected_idp = request.GET.get('idp', None)
127-
conf = get_config(config_loader_path, request)
132+
try:
133+
conf = get_config(config_loader_path, request)
134+
except SourceNotFound as excp:
135+
msg = ('Error, IdP EntityID was not found '
136+
'in metadata: {}')
137+
logger.exception(msg.format(excp))
138+
return HttpResponse(msg.format(('Please contact '
139+
'technical support.')),
140+
status=500)
128141

129142
kwargs = {}
130143
# pysaml needs a string otherwise: "cannot serialize True (type bool)"

0 commit comments

Comments
 (0)