wsHttpBinding配置
我正在读一本 wcf 书,遇到以下代码块,
<bindings>
<wsHttpBinding>
<binding name="ProductsServiceWSHttpBindingConfig">
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="None" />
<message clientCredentialType="UserName" />
</security>
</binding>
</wsHttpBinding>
</bindings>
我对
和
感到困惑> 我进行了在线搜索并得出了每个的含义。但是,不确定该代码块的结果是什么。提前致谢。
I was reading a wcf book and come accross the following code block
<bindings>
<wsHttpBinding>
<binding name="ProductsServiceWSHttpBindingConfig">
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="None" />
<message clientCredentialType="UserName" />
</security>
</binding>
</wsHttpBinding>
</bindings>
I'm confused with the <transport ....>
and <message ...>
I did onlne search and was able to conclude meaning of each. But, not sure what will be the outcome of this code block. Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您要为
WsHttpBinding
配置安全性时,您首先必须选择如何保护通信的安全。这是由安全元素
中的mode
配置的:None
- 无安全和身份验证Transport
- 通信将在以下时间加密传输级别 (HTTPS) 和身份验证也将在传输级别完成(通过 HTTP 标头)TransportWithMessageCredential
- 通信将在传输级别 (HTTPS) 上加密,身份验证将在消息级别完成(通过标准化) SOAP 标头)消息
- 每条消息都将按照 WS-Security 标准单独加密和签名,并通过 HTTP 发送,并且身份验证也将在消息级别完成。加密、签名和身份验证使用标准化 SOAP 标头。定义
mode
后,您可以使用transport
和message
元素进一步指定特定mode
中使用的安全性详细信息。最常见的设置是 clientCredentialType,它指定服务如何对客户端进行身份验证。transport
元素提供 HTTP 协议中可用的模式,message
元素提供 WS-Security 指定的模式。您的配置使用 HTTPS 和 SOAP 标头(用户名令牌)定义端点绑定,以将用户名和密码传递给服务。
When you are going to configure security for
WsHttpBinding
you first have to choose how the communication will be secured. That is configured bymode
in securityelement
:None
- no security and authenticationTransport
- communication will be encrypted on transport level (HTTPS) and authentication will be done on transport level as well (through HTTP headers)TransportWithMessageCredential
- communication will be encrypted on transport level (HTTPS) and authentication will be done on message level (trough standardized SOAP headers)Message
- each message will be separately encrypted and signed following WS-Security standards and send over HTTP and authentication will be done on message level as well. Encryption, signing and authentication use standardized SOAP headers.Once you defined
mode
you can usetransport
andmessage
elements to further specify details of security used in specificmode
. The most common setting isclientCredentialType
which specifies how is client authenticated by the service.transport
element offers modes available in HTTP protocol andmessage
element offers modes specified by WS-Security.Your configuration defines binding for endpoint using HTTPS and SOAP header (UserName Token) for passing user name and password to the service.