Test WCF with Mutual Certificate Authentication using SOAPUI

做~自己de王妃 提交于 2019-12-11 18:19:00

问题


I´m trying to test a WCF service with mutual certificates authentication using a client on C# and it works; now I want to test the service using SOAP UI.

This is the service configuration:

  <system.serviceModel>
<services>
  <service behaviorConfiguration="ServiceBehavior"  name="WS_XXXXX.WcfXXXX">
    <endpoint address="" 
        binding="customBinding" bindingConfiguration="XXXSoap" bindingNamespace=""
        contract="IXXXSoap" >
    </endpoint>
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:47037/"/>
      </baseAddresses>
    </host>
  </service>
</services>
<bindings>
  <customBinding>
    <binding name="XXXSoap">
      <security authenticationMode="SecureConversation"
                   requireSignatureConfirmation="false"
                   canRenewSecurityContextToken="true"
                   messageProtectionOrder="SignBeforeEncrypt"
                   messageSecurityVersion="WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11"
                   requireDerivedKeys="false" >
      <secureConversationBootstrap 
           authenticationMode="MutualCertificate"
           requireSignatureConfirmation="true"
                   canRenewSecurityContextToken="true"
                   messageProtectionOrder="SignBeforeEncrypt"
                   messageSecurityVersion="WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11"
                   requireDerivedKeys="false">
      </secureConversationBootstrap>
      </security>
      <textMessageEncoding messageVersion ="Soap11WSAddressingAugust2004"  >
      </textMessageEncoding>
      <httpTransport />
    </binding>
  </customBinding>


</bindings>
<behaviors>
  <serviceBehaviors>
    <behavior name="ServiceBehavior" >
      <serviceCredentials>

        <serviceCertificate findValue="WCfClient"
                            storeLocation="CurrentUser"
                            storeName="My"
                            x509FindType="FindBySubjectName" />
      </serviceCredentials>
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />

I read some info on how to test a WCF service with service certificate on SOAPUI; but because of the WCF configuration (mutual certificates), I don´t know how to configure the SOAP UI for test the WCF web service.

Thanks in advance.


回答1:


When we use mutual certificate mode to authenticate the client and protect the server communication. We need to establish the trust relationship between the client and the server, then we provide the client certificate on the clients-side when calling the service. For some kinds of WCF created with message security, we might need to on the client-side provide the service certificate that the server-side used.
Anyhow, we at least a client certificate on the client-side. In SOAPUI, we are able to configure the client certificate for one request or all request.
Here are steps details.
1. Export your certificate that your client needs to provide by using the export wizard.

2. Please tick “export the private key” option.

3. Input your password.

4. Set up the certificate for all request. the menu locates in the main toolbar File > Preferences.

Result.

For sending https request for one, please refer to the below link. It is similar to these steps.
https://www.soapui.org/docs/functional-testing/sending-https-requests.html

Feel free to let me know if the problem still exists.



来源:https://stackoverflow.com/questions/57892724/test-wcf-with-mutual-certificate-authentication-using-soapui

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!