summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kanakarakis <ivan.kanak@gmail.com>2020-10-29 20:56:39 +0200
committerIvan Kanakarakis <ivan.kanak@gmail.com>2020-10-30 12:55:10 +0200
commit9dae13cd1f0af7c1aec531da6bc9c87c6c71eaaa (patch)
treeb6f6e5815a927cfa7ba9e8a831f1850731558358
parentcd7f2390971dcfea146947606f62c4188d70dbbd (diff)
downloadpysaml2-9dae13cd1f0af7c1aec531da6bc9c87c6c71eaaa.tar.gz
Improve warning messages
Signed-off-by: Ivan Kanakarakis <ivan.kanak@gmail.com>
-rw-r--r--src/saml2/client_base.py7
-rw-r--r--src/saml2/mdstore.py2
-rw-r--r--src/saml2/server.py8
3 files changed, 8 insertions, 9 deletions
diff --git a/src/saml2/client_base.py b/src/saml2/client_base.py
index 28e08b84..41df6585 100644
--- a/src/saml2/client_base.py
+++ b/src/saml2/client_base.py
@@ -191,8 +191,11 @@ class Base(Entity):
]
):
warn_msg = (
- "The SAML service provider accepts unsigned SAML Responses "
- "and Assertions. This configuration is insecure."
+ "The SAML service provider accepts "
+ "unsigned SAML Responses and Assertions. "
+ "This configuration is insecure. "
+ "Consider setting want_assertions_signed, want_response_signed "
+ "or want_assertions_or_response_signed configuration options."
)
logger.warning(warn_msg)
_warn(warn_msg)
diff --git a/src/saml2/mdstore.py b/src/saml2/mdstore.py
index 3dfd0e5a..c0eb1686 100644
--- a/src/saml2/mdstore.py
+++ b/src/saml2/mdstore.py
@@ -193,7 +193,7 @@ def destinations(srvs):
"instead, use `saml2.mdstore.locations` or `saml2.mdstore.all_locations`."
)
logger.warning(warn_msg)
- _warn(warn_msg)
+ _warn(warn_msg, DeprecationWarning)
values = list(locations(srvs))
return values
diff --git a/src/saml2/server.py b/src/saml2/server.py
index 6051be3a..eb6dddea 100644
--- a/src/saml2/server.py
+++ b/src/saml2/server.py
@@ -7,7 +7,6 @@ or attribute authority (AA) may use to conclude its tasks.
"""
import logging
import os
-from warnings import warn as _warn
import importlib
import dbm
@@ -525,11 +524,8 @@ class Server(Entity):
if not name_id and userid:
try:
- name_id = self.ident.construct_nameid(userid, policy,
- sp_entity_id)
- warn_msg = "Unspecified NameID format"
- logger.warning(warn_msg)
- _warn(warn_msg)
+ name_id = self.ident.construct_nameid(userid, policy, sp_entity_id)
+ logger.warning("Unspecified NameID format")
except Exception:
pass