none
Writing WCF interceptor for WCF WS-Security and WSE Nonce Authentication RRS feed

  • Question

  • I Have to write a WCF Interceptor which will extend the WCF Behaviour 

    The behavior of my extension is that it will add a custom header to the request....

    custom Header is going to be like below

    <soapenv:Header>
      <wsse:Security soapenv:mustUnderstand="1"
          xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
        <wsse:UsernameToken wsu:Id="UsernameToken-8"
          xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
          <wsse:Username>TeStUsErNaMe1</wsse:Username>
          <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"                  >TeStPaSsWoRd1</wsse:Password>
          <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary"                  >f8nUe3YupTU5ISdCy3X9Gg==</wsse:Nonce>
          <wsu:Created>2011-05-04T19:01:40.981Z</wsu:Created>
        </wsse:UsernameToken>
    </wsse:Security>

    I have written a CustomCredential which will add the header to the request.

    my problem is how to wirte extension of this WCF Behavior 

    as it is using CustomCredentials 

    I want something like below 

    client.ChannelFactory.Endpoint.Behaviors.Remove<System.ServiceModel.Description.ClientCredentials>();
    client.ChannelFactory.Endpoint.Behaviors.Add(new CustomCredentials());

    in my WCF Interceptor


    • Edited by BizDev1988 Friday, February 22, 2013 8:07 PM
    Friday, February 22, 2013 7:58 PM

Answers