使用wss4j连接到weblogic Web服务时,无法使用UsernameToken声明身份

时间:2014-07-04 12:06:46

标签: java web-services weblogic ws-security wss4j

我正在尝试使用wss4j连接到一个Web服务,以使用带有密码的用户名令牌安全包装我的xml摘要形式,下面是我的请求输出:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:UsernameToken wsu:Id="UsernameToken-C53A9DE4F384C9293314044748291431">
<wsse:Username>weblogicdev</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">cfxACgO/wSzJSIjd9r8119BURWY=</wsse:Password>
<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">76O2tFwe2NQLw/ZOiTgtyA==</wsse:Nonce>
<wsu:Created>2014-07-04T11:53:49.141Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<mdsl:CustomerRequest xmlns:mdsl="www.mdsl.eft.cms.com">
<mdsl:Institution>1
</mdsl:Institution>
<mdsl:Customer_ID>00236615
</mdsl:Customer_ID>
<mdsl:Data_Level>A
</mdsl:Data_Level>
</mdsl:CustomerRequest>   
</soapenv:Body>
</soapenv:Envelope>

我似乎无法弄清楚为什么这个请求给了我一个:

<?xml version='1.0' encoding='UTF-8'?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Body>
<env:Fault xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<faultcode>wsse:FailedAuthentication</faultcode>
<faultstring>Failed to assert identity with UsernameToken.</faultstring>
</env:Fault>
</env:Body>
</env:Envelope>

但是当我使用密码摘要在jdev上实现ws security时,请求会正常工作。(使用weblogic api实现jax-ws)

用户名weblogicdev和密码weblogic123有效且当我在Web服务上放置的策略是用户名密码令牌plain(明文密码)时请求有效

oracle处理摘要密码的方式与使用wss4j制作的密码不同吗? 如果是的话,是否有人有一个算法我可以用来复制这个密码摘要生成?

1 个答案:

答案 0 :(得分:0)

根据您为Web服务选择的身份验证方法,您可能必须将此用户/密码添加到weblogic管理控制台中的SecurityRealm。