首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用安全UserNameToken的webservice

使用安全UserNameToken的webservice
EN

Stack Overflow用户
提问于 2009-01-20 15:28:29
回答 1查看 5.3K关注 0票数 0

出于安全考虑,我试图解决一个问题,我们使用glassfish V2发布一个简单的web服务,使用普通的UserNameToken。由于我们使用Netbeans 6.5对其进行存档,所以我们正在研究本教程

因此,完成了以下步骤:在开发环境中,我们安装了Sun Java(TM)系统访问管理器,并可以通过管理控制台和Netbeans IDE管理它。一切都很好。本教程中的例子非常有效,因此我们认为我们处于一个很好的位置可以继续前进。

在更改web服务的安全选项之后,我们在没有安装任何Netbeans的测试环境中发布了这个选项。

在此之后,采取了以下步骤:

  1. 部署服务
  2. 为IP地址在Access Manager中配置域
  3. 设置访问web服务的预期用户。

当我们的合作伙伴现在正在访问web服务时,实际的web服务代码没有被访问,而且我们总是在服务器日志中发现安全头没有被理解。

这是我们在服务器上接收到的消息:

代码语言:javascript
复制
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" soapenv:mustUnderstand="1">
<wsu:Timestamp xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="Timestamp-10034404">
<wsu:Created>2009-01-19T16:33:38.537Z</wsu:Created>
<wsu:Expires>2009-01-19T16:34:08.537Z</wsu:Expires></wsu:Timestamp><wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="UsernameToken-10034094">
<wsse:Username>myUser</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">myPasswd</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
<wsa:MessageID soapenv:mustUnderstand="0">uuid:ecc3b150-e646-11dd-96e5-9f80a576275b</wsa:MessageID>
<wsa:To soapenv:mustUnderstand="0">http://62.154.241.166:8080/HTNGService/WebServiceForTrustService</wsa:To>
<wsa:Action soapenv:mustUnderstand="0">http://webservice.trustinternational.com/ws/services/Htng2ReservationService</wsa:Action>
<wsa:From xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing" soapenv:mustUnderstand="0">
<wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address></wsa:From>
</soapenv:Header>
<soapenv:Body>
...
</soapenv:Body></soapenv:Envelope>

我们的wsit.xml看起来如下:

代码语言:javascript
复制
<?xml version="1.0" encoding="UTF-8"?>
<definitions
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="WebServiceForTrustService" targetNamespace="http://wstrust/" xmlns:tns="http://wstrust/" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp1="http://www.w3.org/ns/ws-policy" xmlns:fi="http://java.sun.com/xml/ns/wsit/2006/09/policy/fastinfoset/service" xmlns:tcp="http://java.sun.com/xml/ns/wsit/2006/09/policy/soaptcp/service"
>

<message name="otaHotelResNotif"/>
<message name="otaHotelResNotifResponse"/>
<portType name="WebServiceForTrust">
<operation name="otaHotelResNotif">
<input message="tns:otaHotelResNotif"/>
<output message="tns:otaHotelResNotifResponse"/>
</operation>
</portType>
<binding name="WebServiceForTrustPortBinding" type="tns:WebServiceForTrust">
<wsp:PolicyReference URI="#WebServiceForTrustPortBindingPolicy"/>
<operation name="otaHotelResNotif">
<input/>
<output/>
</operation>
</binding>
<service name="WebServiceForTrustService">
<port name="WebServiceForTrustPort" binding="tns:WebServiceForTrustPortBinding"/>
</service>
<wsp:Policy wsu:Id="WebServiceForTrustPortBindingPolicy">
<wsp:ExactlyOne>
<wsp:All/>
</wsp:ExactlyOne>
</wsp:Policy>
</definitions>

有人知道这里可能缺少什么配置吗?

我们还意识到,在IDE中,打开安全性(AM安全性)之后,在配置文件/ amserver下创建了一个名为amconfig.xml的文件。

在部署服务之后,我们无法在we服务器上找到这个文件,也不能在*.war中找到,也不能在加载项/amserver下面找到。

该文件内部如下所示:

代码语言:javascript
复制
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:AMConfig xmlns:ns2="http://identity.netbeans.org/access_manager_config_1_0">
<ProviderConfig type="WSP" name="WebServiceForTrustService">
<SecurityMechanism uri="urn:sun:wss:security:null:UserNameToken-Plain"/>
</ProviderConfig>
</ns2:AMConfig>

由于信息已经发布在服务器上的sun-web.xml中,所以我认为这不应该是问题,但可能会对您有所帮助。

EN

回答 1

Stack Overflow用户

发布于 2009-01-21 16:41:29

因为我们在上面做了更多的工作,所以即使它还没有解决,也有一些新的东西。

示例教程是重新构建并部署在测试服务器上的。客户端和服务器测试应用程序。当在测试服务器上本地启动时,两者都正常工作。

如果我们配置来自远程的客户端如何使用具有相同安全信息的同一个web服务,我们就会发现与其他应用程序相同的错误。

因此,我假设它与配置o Access有关,但不知道是哪个配置。

我希望这能帮助任何人帮助我。谢谢!

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/461753

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档