Attempt to force WCF client to work with wess 1.0 username token

I am trying to use a WCF client to call a third-party web service. Web Service Uses WSS-Security 1.0 Username Token Authentication Soap Message Security

Here is an example of a soap authentication header for what the web service expects

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<wsse:Security soap:mustUnderstand="1">
<wsse:UsernameToken namespaces>
<wsse:Username>username</wsse:Username>
<wsse:Password Type="type info">password</wsse:Password>
<wsse:Nonce>nonce</wsse:Nonce>
<wsu:Created>date created</wsu:Created>
</wsse:UsernameToken>
<wsse:Security>
</soap:Header>
<soap:Body>
<WebServiceMethodName xmlns="Web Service Namespace" />

  

I configured the client as follows

<basicHttpBinding>
<binding name="Binding1">
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="Basic"/>
</security>
</basicHttpBinding>

but received an error message indicating that the nonce and datecreated attributes were missing in the header. Does anyone know how to configure a WCF client to work with

WSS-Security 1.0 Soapy Username Token Authentication?

+3
source share
2 answers

. serlializer MessageInspector, UsernameToken BeforeSendRequest. .

( ) WS-I Basic Profile Password Digest - WCF. , PDF.

, StackOverflow " WCF, - Axis 2 WS-Security UsernameToken PasswordDigest ":

+3

, , , , WCF Nonce.

( ),

     <basicHttpBinding>
        <binding name="BasicHTTP">
          <!-- UsernameToken over Transport Security -->
          <security mode="TransportWithMessageCredential">
            <message clientCredentialType ="UserName" />
          </security>
        </binding>
      </basicHttpBinding>

, ( , ) UserNameToken WCF WSS4J . http://social.msdn.microsoft.com/Forums/en/wcf/thread/6bc1b0e4-424b-4e2a-909c-815095be631f

WSSConfig.getDefaultWSConfig() setAllowNamespaceQualifiedPasswordTypes (). WSS4J.

UPDATE: WCF , CustomCredential CustomTokenSerializer ref http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/4df3354f-0627-42d9-b5fb-6e880b60f8ee

+1

Source: https://habr.com/ru/post/1743571/


All Articles