Skip to content

Commit c83efe2

Browse files
committed
It happens that the SP cannot find the EntityID in its Metadata, throwing a saml2.mdstore.SourceNotFound Exception.
Exception will raise if metadata source is defined as "remote" it's url is not reachable.
2 parents 9e4cadd + 5561d11 commit c83efe2

File tree

3 files changed

+27
-7
lines changed

3 files changed

+27
-7
lines changed

CHANGES

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
Changes
22
=======
33

4-
UNRELEASED
4+
0.17.2 (2018-08-29)
5+
----------
6+
- Upgraded pysaml2 dependency to version 4.6.0 which fixes security issue.
7+
8+
Thanks to plumdog
9+
10+
0.17.1 (2018-07-16)
511
----------
612
- A 403 (permission denied) is now raised if a SAMLResponse is replayed, instead of 500.
13+
- Dropped support for Python 3.3
14+
- Upgraded pysaml2 dependency to version 4.5.0
15+
16+
Thanks to francoisfreitag, mhindery, vkurup, peppelinux
717

818
0.16.11 (2017-12-25)
919
----------

djangosaml2/views.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@
4242
from saml2.s_utils import UnsupportedBinding
4343
from saml2.response import (
4444
StatusError, StatusAuthnFailed, SignatureError, StatusRequestDenied,
45-
UnsolicitedResponse,
45+
UnsolicitedResponse, StatusNoAuthnContext,
4646
)
47+
from saml2.mdstore import SourceNotFound
4748
from saml2.validate import ResponseLifetimeExceed, ToEarly
4849
from saml2.xmldsig import SIG_RSA_SHA1, SIG_RSA_SHA256 # support for SHA1 is required by spec
4950

@@ -134,7 +135,15 @@ def login(request,
134135
})
135136

136137
selected_idp = request.GET.get('idp', None)
137-
conf = get_config(config_loader_path, request)
138+
try:
139+
conf = get_config(config_loader_path, request)
140+
except SourceNotFound as excp:
141+
msg = ('Error, IdP EntityID was not found '
142+
'in metadata: {}')
143+
logger.exception(msg.format(excp))
144+
return HttpResponse(msg.format(('Please contact '
145+
'technical support.')),
146+
status=500)
138147

139148
# is a embedded wayf needed?
140149
idps = available_idps(conf)
@@ -284,6 +293,9 @@ def assertion_consumer_service(request,
284293
except StatusRequestDenied:
285294
logger.warning("Authentication interrupted at IdP.", exc_info=True)
286295
return fail_acs_response(request)
296+
except StatusNoAuthnContext:
297+
logger.warning("Missing Authentication Context from IdP.", exc_info=True)
298+
return fail_acs_response(request)
287299
except MissingKey:
288300
logger.exception("SAML Identity Provider is not configured correctly: certificate key is missing!")
289301
return fail_acs_response(request)

setup.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def read(*rnames):
3131

3232
setup(
3333
name='djangosaml2',
34-
version='0.16.11',
34+
version='0.17.2',
3535
description='pysaml2 integration for Django',
3636
long_description='\n\n'.join([read('README.rst'), read('CHANGES')]),
3737
classifiers=[
@@ -49,7 +49,6 @@ def read(*rnames):
4949
"Programming Language :: Python :: 2",
5050
"Programming Language :: Python :: 2.7",
5151
"Programming Language :: Python :: 3",
52-
"Programming Language :: Python :: 3.3",
5352
"Programming Language :: Python :: 3.4",
5453
"Programming Language :: Python :: 3.5",
5554
"Programming Language :: Python :: 3.6",
@@ -71,8 +70,7 @@ def read(*rnames):
7170
install_requires=[
7271
'defusedxml>=0.4.1',
7372
'Django>=1.8',
74-
'enum34;python_version > "3" and python_version < "3.4"',
75-
'pysaml2==4.5.0',
73+
'pysaml2>=4.6.0',
7674
],
7775
extras_require=extra,
7876
)

0 commit comments

Comments
 (0)