Web services 使用安全UserNameToken的webservice

Web services 使用安全UserNameToken的webservice,web-services,glassfish,ws-security,usernametoken,Web Services,Glassfish,Ws Security,Usernametoken,出于安全原因,我试图解决使用glassfish V2发布简单web服务时遇到的一个问题,该服务使用普通的UserNameToken。因为我们使用Netbeans 6.5来归档,所以我们正在研究 因此,执行了以下步骤: 在我们的开发环境中,我们安装了sunjava(TM)系统访问管理器,可以通过管理控制台以及netbeanside来管理它。一切都好。教程中的示例非常有效,因此我们认为我们可以继续前进 在更改web服务的安全选项后,我们在测试环境中发布了此选项,但没有安装任何Netbeans 之后,

出于安全原因,我试图解决使用glassfish V2发布简单web服务时遇到的一个问题,该服务使用普通的UserNameToken。因为我们使用Netbeans 6.5来归档,所以我们正在研究

因此,执行了以下步骤: 在我们的开发环境中,我们安装了sunjava(TM)系统访问管理器,可以通过管理控制台以及netbeanside来管理它。一切都好。教程中的示例非常有效,因此我们认为我们可以继续前进

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

之后,完成以下步骤:

  • 部署服务
  • 在Access Manager中为IP地址配置域
  • 设置预期用户以访问web服务
  • 当我们的合作伙伴现在正在访问web服务时,实际的web服务代码没有被访问,并且我们总是在服务器日志中发现安全标头没有被理解

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

    <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>
    
    
    2009-01-19T16:33:38.537Z
    2009-01-19T16:34:08.537Z
    我的用户
    我的密码
    uuid:ecc3b150-e646-11dd-96e5-9f80a576275b
    http://62.154.241.166:8080/HTNGService/WebServiceForTrustService
    http://webservice.trustinternational.com/ws/services/Htng2ReservationService
    http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
    ...
    
    我们的wsit.xml如下所示:

    <?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>
    
    
    
    有人知道这里可能缺少什么配置吗

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

    在部署服务后,我们无法在Web服务器上、在*.war中或在addons/amserver下找到此文件

    文件内部看起来像:

    <?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>
    
    
    

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

    因为我们在上面做了进一步的工作,所以这里有一些新的东西,即使没有解决

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

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

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

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