How to turn off SecureConversationToken in WCF web service

扶醉桌前 提交于 2019-12-10 11:47:32

问题


I have a WCF web service with WS-* security and I need to write a Java client for it using WSS4J API. But, as it turns out WSS4J does not support the <SecurityContextToken> and <DerivedKeyToken> tags, which are specific to WS-SecureConversation.

is there a way to turn it off via code or better, via web.config?

UPDATE:

Service definition:

      <service name="my.service" 
           behaviorConfiguration="SecureTransport">
    <endpoint 
      address="mex" 
      binding="mexHttpBinding" 
      contract="IMetadataExchange" />
    <endpoint 
      contract="my.interface" 
      binding="wsHttpBinding" 
      bindingConfiguration="UsernameAndPassword"/>
  </service>

Behaviour and Bindings:

<behaviors>
  <serviceBehaviors>
    <behavior name="SecureTransport">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true"/>
      <serviceCredentials>
        <userNameAuthentication   userNamePasswordValidationMode="Custom"
                                  customUserNamePasswordValidatorType="example.API.Security.CustomUserNameValidator, APISecurity" />
        <serviceCertificate findValue="CN=Example" storeLocation="LocalMachine" storeName="TrustedPeople" x509FindType="FindBySubjectDistinguishedName" />
      </serviceCredentials>
    </behavior>
  </serviceBehaviors>
</behaviors>

<bindings>
  <wsHttpBinding>
    <binding name="UsernameAndPassword">
      <security mode="Message">
        <message clientCredentialType="UserName" />            
      </security>
    </binding>
  </wsHttpBinding>
</bindings>

回答1:


Just turn security context and probably also negotiation in your binding configuration:

<bindings>
  <wsHttpBinding>
    <binding name="UsernameAndPassword">
      <security mode="Message">
        <message clientCredentialType="UserName" establishSecurityContext="false"
                 negotiateServiceCredential="false" />            
      </security>
    </binding>
  </wsHttpBinding>
</bindings>


来源:https://stackoverflow.com/questions/8552029/how-to-turn-off-secureconversationtoken-in-wcf-web-service

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