Skip to content

Commit 0c8f22f

Browse files
committed
Set error log message as : incorrectly_signed_response, when assertion signature verification fails
1 parent 3fc608a commit 0c8f22f

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/saml2/response.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ def _assertion(self, assertion, verified=False):
791791
try:
792792
self.sec.check_signature(assertion, class_name(assertion), self.xmlstr)
793793
except Exception as exc:
794-
logger.error("correctly_signed_response: %s", exc)
794+
logger.error("incorrectly_signed_response: %s", exc)
795795
raise
796796

797797
self.assertion = assertion

tests/test_41_response.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python
2-
2+
import logging
33
from contextlib import closing
44
import datetime
55
from unittest.mock import Mock
@@ -125,7 +125,8 @@ def test_issuer_none(self):
125125
assert resp.issuer() == ""
126126

127127
@patch("saml2.time_util.datetime")
128-
def test_false_sign(self, mock_datetime):
128+
def test_false_sign(self, mock_datetime, caplog):
129+
caplog.set_level(logging.ERROR)
129130
mock_datetime.utcnow = Mock(return_value=datetime.datetime(2016, 9, 4, 9, 59, 39))
130131
with open(FALSE_ASSERT_SIGNED) as fp:
131132
xml_response = fp.read()
@@ -145,6 +146,7 @@ def test_false_sign(self, mock_datetime):
145146
assert isinstance(resp, AuthnResponse)
146147
with raises(SignatureError):
147148
resp.verify()
149+
assert 'incorrectly_signed_response' in caplog.text
148150

149151
def test_other_response(self):
150152
with open(full_path("attribute_response.xml")) as fp:

0 commit comments

Comments
 (0)