我们可能会收到此错误的一种可能情况是,如果我们使用标头中介来发送自定义 SOAP 安全标头。
例如,我在 [1] 中创建了一个代理,您可能会注意到我将以下元素放在了 soap 消息安全标头中。
<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">95euUDNp5wT7nT3BadS9Tw==</wsse:Nonce>
由于我每次都向后端发送相同的随机数,因此后端将其检测为可能的重放攻击。
为了摆脱这个错误,我删除了上面的“Nonce”元素。然后后端停止给出错误
“Nonce 值:95euUDNp5wT7nT3BadS9Tw==,之前已经看到用户名:admin。这可能是重放攻击。”
了。
只有当我们在 Soap 安全标头中发送“Nonce”元素时,后端才会检查可能的重放攻击。因此,删除该元素是消除错误的一种方法。
这也意味着,仅当您不希望后端评估 Nonce 值以检测重放攻击时,这才是一种解决方案。
我知道这个问题已经一岁了;但想添加一个答案作为参考。
[1]
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="InsuranceServiceProxy2"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<header scope="default">
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
soapenv:mustUnderstand="1">
<wsu:Timestamp wsu:Id="TS-23">
<wsu:Created>2015-06-13T03:07:55Z</wsu:Created>
</wsu:Timestamp>
<wsse:UsernameToken wsu:Id="UsernameToken-22">
<wsse:Username>admin</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">admin</wsse:Password>
<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">95euUDNp5wT7nT3BadS9Tw==</wsse:Nonce>
<wsu:Created>2015-06-13T03:07:55.091Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</header>
<property name="Authorization"
value="Basic YWRtaW46YWRtaW4="
scope="transport"
type="STRING"/>
</inSequence>
<outSequence>
<send/>
</outSequence>
<endpoint>
<address uri="https://localhost:8243/services/InsuranceServiceBEProxy2"/>
</endpoint>
</target>
<description/>
</proxy>