WCF:使用自定义 UserNamePasswordValidationMode 而不使用 SSL 证书
对于客户,我必须使用 WCF 在客户端和服务器应用程序之间进行通信。
我的应用程序使用 WSHttpBinding 进行通信,但现在,客户不需要安装任何 SSL 证书,因为: 服务器
- 只能通过 VPN 访问,因此通信已经加密
- 他们的计算机不在域中,因此他们可以不使用域 CA
- 服务器的名称没有公共 IP,因此他们无法为此 ip 购买 SSL 证书
所以我开始研究如何不使用任何 SSL 证书,但我遇到了一些问题:
我发现我应该使用安全模式的“TransportCredentialOnly”设置,但此设置不适用于“WsHttpBinding”。所以我决定使用 basicHttpBinding,它有这个选项,但 basicHttpBinding 似乎不提供使用 CustomUserNamePasswordValidator 的可能性。
那么我该怎么做呢?我发现的每个搜索结果要么使用 SSL 证书,要么没有 customUserNameValidator。
非常感谢您的帮助。
For a customer, I've to use WCF to communicate between a client and a server application.
My application was using a WSHttpBinding to communicate, but now, the customer doesn't to install any SSL certificate, because:
- The server is only VPN accessible, so the communication is already encrypted
- Their computer aren't in a domain, so they can't use a domain CA
- The name of the server hasn't a public IP so they can't buy a SSL certificate for this ip
So I started to look how to don't use any SSL certificate, but I got some problems:
I saw that I should use a "TransportCredentialOnly" settings for the security mode, but this settings isn't available for "WsHttpBinding". So I decided to use the basicHttpBinding, which has this option, but it seems that the basicHttpBinding doesn't offer the possibility to use CustomUserNamePasswordValidator.
So how can I do this? Every search result I found are either using a SSL certificate or don't have customUserNameValidator.
Thank you very much for any help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是非常罕见的情况,发送不安全的用户名和密码是有意义的。您需要为此进行自定义绑定,因为默认绑定不允许这样做。 此答案包含两个选项可以使用。请注意,第一个选项将允许您通过不安全的传输发送纯文本用户名和密码,但它会破坏 WSDL 生成(这是 WCF 中的一个错误)。
This is very rare scenario where sending unsecured username and password make sense. You need custom binding for this because default bindings don't allow this. This answer contains two options you can use. Just be aware that first option will allow you to send plain text user name and password over unsecured transport but it will break WSDL generation (that is a bug in WCF).