Skip to content

Commit 9dae13c

Browse files
committed
Improve warning messages
Signed-off-by: Ivan Kanakarakis <[email protected]>
1 parent cd7f239 commit 9dae13c

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

src/saml2/client_base.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,11 @@ def __init__(self, config=None, identity_cache=None, state_cache=None,
191191
]
192192
):
193193
warn_msg = (
194-
"The SAML service provider accepts unsigned SAML Responses "
195-
"and Assertions. This configuration is insecure."
194+
"The SAML service provider accepts "
195+
"unsigned SAML Responses and Assertions. "
196+
"This configuration is insecure. "
197+
"Consider setting want_assertions_signed, want_response_signed "
198+
"or want_assertions_or_response_signed configuration options."
196199
)
197200
logger.warning(warn_msg)
198201
_warn(warn_msg)

src/saml2/mdstore.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def destinations(srvs):
193193
"instead, use `saml2.mdstore.locations` or `saml2.mdstore.all_locations`."
194194
)
195195
logger.warning(warn_msg)
196-
_warn(warn_msg)
196+
_warn(warn_msg, DeprecationWarning)
197197
values = list(locations(srvs))
198198
return values
199199

src/saml2/server.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
"""
88
import logging
99
import os
10-
from warnings import warn as _warn
1110

1211
import importlib
1312
import dbm
@@ -525,11 +524,8 @@ def create_attribute_response(self, identity, in_response_to, destination,
525524

526525
if not name_id and userid:
527526
try:
528-
name_id = self.ident.construct_nameid(userid, policy,
529-
sp_entity_id)
530-
warn_msg = "Unspecified NameID format"
531-
logger.warning(warn_msg)
532-
_warn(warn_msg)
527+
name_id = self.ident.construct_nameid(userid, policy, sp_entity_id)
528+
logger.warning("Unspecified NameID format")
533529
except Exception:
534530
pass
535531

0 commit comments

Comments
 (0)