如何在WSO2 ESB中自定义用户名令牌安全策略

时间:2014-06-02 11:08:40

标签: security wso2 wso2esb ws-security wso2carbon

我正在使用wso2esb4.8.1。 我希望实现我的用户名令牌安全性。 我正在收到Header Request这样的

 <soapenv:Header>
          <pr:authentication soapenv:actor="http://schemas.xmlsoap.org/soap/fff/next" soapenv:mustUnderstand="0" xmlns:pr="http://webservices.dddd.com/ProxyService">
             <pr:user>mp</pr:user>
             <pr:password>MW_ssp003</pr:password>
          </pr:authentication>
       </soapenv:Header>

如果WSO2 ESB标准不允许我这样做,他们只采用这种格式的标题

<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" soapenv:mustUnderstand="1">
         <wsu:Timestamp wsu:Id="TS-4">
            <wsu:Created>2014-06-02T07:15:21Z</wsu:Created>
            <wsu:Expires>2014-06-02T08:38:41Z</wsu:Expires>
         </wsu:Timestamp>
         <wsse:UsernameToken wsu:Id="UsernameToken-3">
            <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">byWKVY4stEATvTqaoNMswQ==</wsse:Nonce>
            <wsu:Created>2014-06-02T07:15:21.304Z</wsu:Created>
         </wsse:UsernameToken>
      </wsse: >
   </soapenv:Header>

我如何将其更改为我的愿望格式。我尝试在Registry中编辑策略scenario1 像这样

<wsp:Policy wsu:Id="UTOverTransport" soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xmlns:pr="http://webservices.irancell.com/ProxyService"             xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
            xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
    <wsp:ExactlyOne>
        <wsp:All>
            <sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
                <wsp:Policy>
                    <sp:TransportToken>
                        <wsp:Policy>
                            <sp:HttpsToken RequireClientCertificate="false"/>
                        </wsp:Policy>
                    </sp:TransportToken>
                    <sp:AlgorithmSuite>
                        <wsp:Policy>
                            <sp:Basic256/>
                        </wsp:Policy>
                    </sp:AlgorithmSuite>
                    <sp:Layout>
                        <wsp:Policy>
                            <sp:Lax/>
                        </wsp:Policy>
                    </sp:Layout>
                    <sp:IncludeTimestamp/>
                </wsp:Policy>
            </sp:TransportBinding>
            <soapenv:Header>

      <pr:authentication soapenv:actor="http://schemas.xmlsoap.org/soap/mhk/next" soapenv:mustUnderstand="0" xmlns:pr="http://webservices.mwetp.com/ProxyService">
               </pr:authentication>
   </soapenv:Header>
        </wsp:All>
    </wsp:ExactlyOne>
</wsp:Policy>

但无法解决此问题,如此

[2014-06-02 16:10:18,216] ERROR - RPCInOnlyMessageReceiver loadingPolicy
org.wso2.carbon.security.SecurityConfigException: loadingPolicy
        at org.wso2.carbon.security.config.SecurityConfigAdmin.applyPolicy(Secur
ityConfigAdmin.java:946)
        at org.wso2.carbon.security.config.SecurityConfigAdmin.applyPolicy(Secur
ityConfigAdmin.java:809)
        at org.wso2.carbon.security.config.SecurityConfigAdmin.applySecurity(Sec
urityConfigAdmin.java:738)
        at org.wso2.carbon.security.config.service.SecurityConfigAdminService.ap
plySecurity(SecurityConfigAdminService.java:52)

对此的任何帮助都非常感谢。 在此先感谢。

0 个答案:

没有答案