Skip to content

Commit 9670129

Browse files
committed
Restore backwards compatible behaviour if signatures aren't specified
1 parent 74526d1 commit 9670129

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/zeep/wsse/signature.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -247,13 +247,13 @@ def _signature_prepare(envelope, key, signature_method, digest_method, signature
247247
# Perform the actual signing.
248248
ctx = xmlsec.SignatureContext()
249249
ctx.key = key
250-
# Sign default elements if present
251-
timestamp = security.find(QName(ns.WSU, "Timestamp"))
252-
if timestamp != None:
253-
_sign_node(ctx, signature, timestamp, digest_method)
254-
255-
# Sign extra elements defined in WSDL
256-
if signatures is not None:
250+
# Preserve the previous behaviour for backwards compatibility
251+
if signatures is None:
252+
_sign_node(ctx, signature, envelope.find(QName(soap_env, "Body")), digest_method)
253+
timestamp = security.find(QName(ns.WSU, "Timestamp"))
254+
if timestamp != None:
255+
_sign_node(ctx, signature, timestamp, digest_method)
256+
else:
257257
if signatures["body"] or signatures["everything"]:
258258
_sign_node(
259259
ctx, signature, envelope.find(QName(soap_env, "Body")), digest_method

0 commit comments

Comments
 (0)