【问题标题】:How to turn off SecureConversationToken in WCF web service如何在 WCF Web 服务中关闭 SecureConversationToken
【发布时间】:2023-03-09 15:27:01
【问题描述】:

我有一个具有 WS-* 安全性的 WCF Web 服务,我需要使用 WSS4J API 为它编写一个 Java 客户端。 但是,事实证明 WSS4J 不支持特定于 WS-SecureConversation 的 <SecurityContextToken><DerivedKeyToken> 标记。

有没有办法通过代码或更好的方式通过 web.config 将其关闭?

更新:

服务定义:

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

行为和绑定:

<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>

【问题讨论】:

  • 你当前的 WCF 配置(绑定)是什么?
  • 我已经用 wcf 配置更新了帖子。

标签: java wcf web-services wss4j


【解决方案1】:

只需在您的绑定配置中打开安全上下文并可能还进行协商:

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

【讨论】:

  • 谢谢,我试试看,如果可行,我会回来标记你的答案:)
猜你喜欢
  • 1970-01-01
  • 2012-03-19
  • 1970-01-01
  • 2013-01-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多