【发布时间】: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